49

Ran into this build error in Xcode 14.3 that prevents me from building my app.

Build service could not create build operation: unknown error while handling message: MsgHandlingError(message: "unable to initiate PIF transfer session (operation in progress?)")

There isn't more detail than that--deleting derived data, restarting Xcode, resetting package caches did not help.

Any ideas?

I tried deleting derived data, restarting Xcode, and resetting package caches to no avail.

Flantasy Flan
  • 1,297
  • 1
  • 9
  • 8

4 Answers4

68

UPDATE: As some others have mentioned, this can be fixed by simply closing Xcode and re-opening it, then doing a regular build (Command+B) instead of running it. Give that a shot before trying the other options!

The error seemed to be resolved by doing the following:

  1. Close Xcode
  2. Open finder, and delete the derived data folder: ~/Library/Developer/Xcode/DerivedData
  3. Open finder, CMD+SHIFT+G and go to ~/Library/Caches/org.swift.swiftpm. Right-click > Show Package Contents, and delete the repositories folder and repositories.lock file.
  4. Open Xcode and let it build naturally

Coworker also resolved this by deleting derived data, rebuilding on Xcode 14.1 or 14.2, and then switching back to Xcode 14.3. Will try these steps again next time I see it to confirm if this is a reliable fix.

Flantasy Flan
  • 1,297
  • 1
  • 9
  • 8
  • 7
    Thanks! Worked for me. In my case I just ran the following from bash: `rm -rf ~/Library/Developer/Xcode/DerivedData/* && rm -rf ~/Library/Caches/org.swift.swiftpm` – jspizziri Apr 11 '23 at 18:44
  • Just doing steps 1 and 2 worked for me – Jacob G Apr 18 '23 at 22:55
  • 2
    Just closing and reopening Xcode worked for me, so doesn't seem related to derived data or spm – Evan Apr 24 '23 at 09:33
  • Closing and opening has worked for me multiple times. I came looking for a solution now, because the issue keeps happening every few days. Hope that the Derived Data cleaning solves the issue permanently. – zeusstl Jun 14 '23 at 19:51
  • This works for Xcode 15 Beta too. – CodeBrew Jul 11 '23 at 18:41
  • Adding some addition to previous @JornRigter comment. I think we need to admit that Xcode never starts working as we would expect it to work! Apple has gave us tool to develop software, that itself needs development but for some reason some bugs are in there since the beginning of Xcode. BTW for me also just Xcode restart did it this time. – Tarvo Mäesepp Jul 28 '23 at 08:09
41

Closing and opening Xcode seems to also remove this error.

Cparello
  • 607
  • 6
  • 8
4

The Error is appeared due to cache issue. Restart mac and xcode can solved it OR

Open Xcode Setting , the Go to Location and click on Dervied Data and Delete All Derived data the clean and build the project error are gone

enter image description here

Engr.Aftab Ufaq
  • 3,356
  • 3
  • 21
  • 47
1

Runs for me:

  1. Close Xcode

  2. Run into the project :

    rm -rf node_modules rm -f package-lock.json rm -f yarn.lock npm cache clean --force npm install

  3. Open finder, and delete the derived data folder: ~/Library/Developer/Xcode/DerivedData

  4. Open finder, CMD+SHIFT+G and go to ~/Library/Caches/org.swift.swiftpm. Right-click > Show Package Contents, and delete the repositories folder and repositories.lock file.

  5. Open Xcode CLEAN PREV BUILD and let it build naturally

Manuel
  • 11
  • 2