Cannot build patch: java.io.FileNotFoundException

Good morning!
I have a build server on a Mac Mini with TeamCity 8.1.2 (latest at the moment). Sources of a Xcode iOS project are transferred from a Mercurial repository. All was fine until I added one more framework to the project (Crashlytics.framework in particular). After that I keep getting errors:

[11:11:26]Checking for changes

[11:11:27]Publishing internal artifacts

[11:11:27]Clearing temporary directory: /TeamCity/buildAgent/temp/buildTmp

[11:11:27]Using vcs information from agent file: 45291ad0f1675cb1.xml

[11:11:27]Clean build enabled: removing old files from /TeamCity/buildAgent/work/45291ad0f1675cb1

[11:11:27]Checkout directory: /TeamCity/buildAgent/work/45291ad0f1675cb1

[11:11:27]Updating sources: server side checkout (9s)

[11:11:27]Will perform clean checkout. Reason: "Clean all files before build" turned on

[11:11:27]Building non-cachable clean patch for VCS root: mercurial: https://hg._____.com/iOSv2; checkout rules: =>; revision: f475d64947ca

[11:11:36]Failed to build patch for build #f475d64947ca {build id=2570}, VCS root: "mercurial: https://hg._____.com/iOSv2" {instance id=16, parent internal id=1, parent id=AwadIOS_Mercurial, description: "mercurial: https://hg._____.com/iOSv2"}, due to error: Cannot build patch: java.io.FileNotFoundException: /TeamCity/temp/hg1/Awad2/ThirdParty/Crashlytics.framework/Resources (No such file or directory)

[11:11:36]Repository sources transferred: 44.57 MB total

[11:11:36]Will repeat attempt when server will be available, number of attempts left: 2

[11:11:46]Updating sources: server side checkout (6s)

[11:11:46][Updating sources] Will perform clean checkout. Reason: "Clean all files before build" turned on

[11:11:46][Updating sources] Building non-cachable clean patch for VCS root: mercurial: https://hg._____.com/iOSv2; checkout rules: =>; revision: f475d64947ca

[11:11:53][Updating sources] Failed to build patch for build #f475d64947ca {build id=2570}, VCS root: "mercurial: https://hg._____.com/iOSv2" {instance id=16, parent internal id=1, parent id=AwadIOS_Mercurial, description: "mercurial: https://hg._____.com/iOSv2"}, due to error: Cannot build patch: java.io.FileNotFoundException: /TeamCity/temp/hg1/Awad2/ThirdParty/Crashlytics.framework/Resources (No such file or directory)

[11:11:53]Will repeat attempt when server will be available, number of attempts left: 1

[11:12:03]Updating sources: server side checkout (7s)

[11:12:03][Updating sources] Will perform clean checkout. Reason: "Clean all files before build" turned on

[11:12:03][Updating sources] Building non-cachable clean patch for VCS root: mercurial: https://hg._____.com/iOSv2; checkout rules: =>; revision: f475d64947ca

[11:12:11]Patch is broken, can be found in file: /TeamCity/buildAgent/temp/globalTmp/temp4320561513237692264patch_2570

[11:12:11]Failed to build patch for build #f475d64947ca {build id=2570}, VCS root: "mercurial: https://hg._____.com/iOSv2" {instance id=16, parent internal id=1, parent id=AwadIOS_Mercurial, description: "mercurial: https://hg._____.com/iOSv2"}, due to error: Cannot build patch: java.io.FileNotFoundException: /TeamCity/temp/hg1/Awad2/ThirdParty/Crashlytics.framework/Resources (No such file or directory)

[11:12:11]

jetbrains.buildServer.agent.impl.patch.PatchDownloaderImpl$1: Server was not able to build correct patch, most likely due to VCS errors

 at jetbrains.buildServer.agent.impl.patch.PatchDownloaderImpl.throwError(PatchDownloaderImpl.java:118)

 at jetbrains.buildServer.agent.impl.patch.PatchDownloaderImpl.checkPatch(PatchDownloaderImpl.java:108)

 at jetbrains.buildServer.agent.impl.patch.PatchDownloaderImpl.copyPatchAndCheck(PatchDownloaderImpl.java:69)

 at jetbrains.buildServer.agent.impl.patch.UpdateSourcesPatcherBase.copyPatchToTempFile(UpdateSourcesPatcherBase.java:71)

 at jetbrains.buildServer.agent.impl.patch.UpdateSourcesFromServer.updateSources(UpdateSourcesFromServer.java:60)

 at jetbrains.buildServer.agent.impl.patch.UpdateSourcesBuildStageBase.doSourceUpdate(UpdateSourcesBuildStageBase.java:91)

 at jetbrains.buildServer.agent.impl.patch.UpdateSourcesBuildStageBase.doRecoverableStage(UpdateSourcesBuildStageBase.java:59)

 at jetbrains.buildServer.agent.impl.buildStages.startStages.RecoverableBuildStage.doLastAttempt(RecoverableBuildStage.java:112)

 at jetbrains.buildServer.agent.impl.buildStages.startStages.RecoverableBuildStage.doBuildStage(RecoverableBuildStage.java:70)

 at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor$1.callStage(BuildStagesExecutor.java:31)

 at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor$1.callStage(BuildStagesExecutor.java:24)

 at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.callRunStage(StagesExecutor.java:78)

 at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.doStages(StagesExecutor.java:37)

 at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor.doStages(BuildStagesExecutor.java:24)

 at jetbrains.buildServer.agent.impl.BuildRunAction.doStages(BuildRunAction.java:70)

 at jetbrains.buildServer.agent.impl.BuildRunAction.runBuild(BuildRunAction.java:50)

 at jetbrains.buildServer.agent.impl.BuildAgentImpl.doActualBuild(BuildAgentImpl.java:265)

 at jetbrains.buildServer.agent.impl.BuildAgentImpl.access$100(BuildAgentImpl.java:52)

 at jetbrains.buildServer.agent.impl.BuildAgentImpl$1.run(BuildAgentImpl.java:231)

 at java.lang.Thread.run(Thread.java:745)

Caused by: jetbrains.buildServer.vcs.patches.UnsuccessfulPatchException: Failed to build patch for build #f475d64947ca {build id=2570}, VCS root: "mercurial: https://hg._____.com/iOSv2" {instance id=16, parent internal id=1, parent id=AwadIOS_Mercurial, description: "mercurial: https://hg._____.com/iOSv2"}, due to error: Cannot build patch: java.io.FileNotFoundException: /TeamCity/temp/hg1/Awad2/ThirdParty/Crashlytics.framework/Resources (No such file or directory)

 at jetbrains.buildServer.vcs.patches.AbstractPatcher$1.fail(AbstractPatcher.java:93)

 at jetbrains.buildServer.vcs.patches.LowLevelPatcher.readPatchStream(LowLevelPatcher.java:165)

 at jetbrains.buildServer.vcs.patches.LowLevelPatcher.applyPatch(LowLevelPatcher.java:88)

 at jetbrains.buildServer.vcs.patches.AbstractPatcher.applyPatch(AbstractPatcher.java:42)

 at jetbrains.buildServer.agent.impl.patch.PatchApplierImpl.applyPatch(PatchApplierImpl.java:18)

 at jetbrains.buildServer.agent.impl.patch.PatchDownloaderImpl.checkPatchInFileIsCompleted(PatchDownloaderImpl.java:88)

 at jetbrains.buildServer.agent.impl.patch.PatchDownloaderImpl.checkPatch(PatchDownloaderImpl.java:98)

 ... 18 more

[11:12:11]Publishing internal artifacts

[11:12:11]Build failed to start. Artifacts will not be published for this build

[11:12:11]Build finished

These errors are gone when I remove Crashlytics.framework from the project. But why?? I'm able to pull/update from repository via SourceTree or even command line without any problem. What's wrong with pulling from TeamCity? I really need this framework in the project.

Thank you in advance.

6 comments
Comment actions Permalink

Hi,

Can you please attach teamcity-vcs.log and teamcity-server.log files while reproducing this issue?

0
Comment actions Permalink

Okay, I switched VCS Checkout Mode to "Automatically on agent" and it completely solved my problem.
Anyway, thank you for your reply.

0
Comment actions Permalink

Hello!
Have same issue with mercurial.  
TC version is 8.1.3.

All logs attached. Thank you.

P.S. Checkout on agent also solves problem.



Attachment(s):
teamcity-vcs.log.zip
teamcity-server.log.zip
build.log.zip
0
Comment actions Permalink

Hi Igor,

the src/test/src/main/webapp/public/node_modules/grunt/node_modules/.bin/js-yaml file - is a regular file or some kind of a symlink?

0
Comment actions Permalink

It's a regular file.
Problem started just after developer pushed this file into repository, after that commit Teamcity started to fail. We removed that file from repository and everything started to be OK, but problem not solved.

0
Comment actions Permalink

Igor, I cannot reproduce that so far. I've created a repository with the same file and in my case a server-side checkout works fine.

Mercurial plugin maintains a clone of your repository under <TeamCity data dir>/system/caches/mercurial. To build a clean patch plugin runs 'hg archive' command which retrieves all the files into a temporary directory. Once files are retrieved, plugin traverses the temporary directory and add a files content to a patch. In your case plugin listed contents of the 'src/test/src/main/webapp/public/node_modules/grunt/node_modules/.bin' directory and saw the file 'js-yaml', but then it tried to read it there was no such a file. Is there anything special about this file? Maybe it has some unusual file permissions? Can you share the repository where this happened or create an open-source repository with the same problem?

0

Please sign in to leave a comment.