TeamCity error: %1 is not a valid Win32 application

I posted a question about this on Stack Overflow:

Here's a copy of the text:


I'm trying to configure Git as a VCS for TeamCity 7.1.2.

When running a build, I'm seeing the following error:

> jetbrains.buildServer.vcs.VcsException: 'git fetch' command failed.
> exception: Cannot run program "c:\TeamCity\jre\bin\java" (in directory "C:\ProgramData\JetBrains\TeamCity\system\caches\git\git-5BB95C96.git"): CreateProcess error=193, %1 is not a valid Win32 application

If I cd to that path in a terminal on the build server and attempt to run the referenced java binary, it runs properly.

The full stack trace is:

    jetbrains.buildServer.vcs.VcsException: 'git fetch' command failed.
    exception: Cannot run program "c:\TeamCity\jre\bin\java" (in directory "C:\ProgramData\JetBrains\TeamCity\system\caches\git\git-5BB95C96.git"): CreateProcess error=193, %1 is not a valid Win32 application
        at jetbrains.buildServer.buildTriggers.vcs.git.CommandLineUtil.getCommandLineError(
        at jetbrains.buildServer.buildTriggers.vcs.git.FetchCommandImpl.fetchInSeparateProcess(
        at jetbrains.buildServer.buildTriggers.vcs.git.FetchCommandImpl.fetch(
        at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.fetch(
        at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.fetch(
        at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.fetchBranchData(
        at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.ensureRevCommitLoaded(
        at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.buildPatch(
        at jetbrains.buildServer.serverSide.impl.projectSources.BuildPatchUtil.buildPatch(
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchComposer.buildCleanPatchToStream(
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchComposer.access$100(
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchComposer$2.constructPatch(
        at jetbrains.buildServer.serverSide.impl.projectSources.SmallPatchCache.getCachedCleanPatch(
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchCacheImpl.requestCachedPatch(
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchComposer.getOrMakeCacheableCleanPatch(
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchComposer.makePatch(
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchComposer.buildPatchForRoot(
        at jetbrains.buildServer.serverSide.impl.projectSources.PatchComposer.buildPatch(
        at jetbrains.buildServer.serverSide.impl.BuildTypeImpl.buildPatch(
        at jetbrains.buildServer.serverSide.impl.BuildStarter$
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$ Source)
        at Source)

Can anyone suggest something to try?

Comment actions Permalink


do you use parameters in the git VCS root?

Comment actions Permalink

Hi Dmitry,

No, I don't use any parameters.


Comment actions Permalink

Please try adding the following to the .BuildServer/config/ (create it if it doesn't exist):\\TeamCity\\jre\\bin\\java.exe

Let me know if it helps.

Comment actions Permalink

Hi Dmitry,

I added the line as described (although the file path was slightly different: /BuildServer/conf/ but I still see the same message when attempting a build.

Is there anything else I can try? Unfortunately I only have intermittent access to the build environment, as and when I'm working with that client.


Comment actions Permalink


are you sure /BuildServer/conf/ is a correct path? I ask because usually git caches are placed under TEAMCITY_DATA_DIR/system/caches/git, in your case it is C:\ProgramData\JetBrains\TeamCity\system\caches\git\git-5BB95C96.git,therefore TEAMCITY_DATA_DIR is C:\ProgramData\JetBrains\TeamCity and should be at C:\ProgramData\JetBrains\TeamCity\config\

Also please check that there is no file c:\TeamCity\jre\bin\java (without .exe in the end).

If that doesn't help, you can workaround the problem by disabling git fetch in a separate process. To do that add the following to


With such an option git-plugin runs the fetch in a TeamCity server process. This setup has its drawbacks - TeamCity server can run out of memory because fetch requires amount of RAM proportional to the biggest object in the repository. So if you store large binaries in git consider increasing amount of memory for TeamCity server.


Please sign in to leave a comment.