Internal inconsistency error (didStartTask)

I just got this error today in our GitHub action CI build. XCode 15.0.

Having this issue too with internal prebuildCommand's but not so many issues with buildCommands where inputs and outputs are known…

Especially issues with build commands that generate resources.

We hit this issue 5-20 times per day, per engineer so it's got a decently significant impact on our workflow. Fortunately, closing and reopening Xcode works some of the time but I'd estimate 30-60 minutes of wasted time per day, per engineer if you factor in context switching and clean/re-build times.

I know this is already on the radar of Xcode folks, but I'm wondering if there's any tips on where this is coming from / how we could change our setup to avoid this while it's being fixed?

Some details that may be relevant:

  1. We use 2 plugins - 1 compiler for some custom macros (all quite simple, mostly for fun) and the Swift OpenAPI generator.
  2. We also have ~70 packages, each with their own individual Package.swift file.
  3. Our codebase is somewhat large but nothing crazy; ~120k LoC

Would gladly switch up our setup with either of those (i.e. ditch macros, manually gen OpenAPI functions, or stop defining local packages with SPM) if it meant saving us 30-60 mins per day.

Appreciate in advance any advice anyone might recommend!

3 Likes

Have you tried Xcode 15.3 beta? We removed all our plugins because it was too much hassle but using pre-build scripts on schemes have started to cause other issues so looking at moving back to plugins.

removed all our plugins because it was too much hassle

Was the hassle that it was causing this internal inconsistency error? Or other things.

Hi Josh,

It was stale builds that killed it for us and we didn't look again until just recently. With Xcode 15.2 it seems like our prebuild command isn't causing consistency issues or any stale builds :crossed_fingers:

15.3b1 was unusable for us due to excessive internal inconsistency errors. 15.3b3 is much better, but anecdotally still seems worse than 15.2.

(There are also other problems in 15.3b3, unrelated to this thread, that make it a nonstarter — swiftc bugs and an inability to run tests on an iOS simulator)

Echoing @KeithBauerANZ; these errors have gotten significantly worse in 15.3. Does anyone know what the source of these are / if there are any workarounds?

Hitting these roughly every 3 builds now :frowning:

We removed swift build plugins (except the macro one) and the problem is significantly reduced (but not gone)

2 Likes

I'm also seeing this -- using the OpenAPI build plugin, seems like that's the common thread here

2 Likes

I've started seeing this as well. I was just able to trigger it by trying to do a normal build while the preview was building. The build service directly crashed at that point.

It's hard to believe Apple hasn't fixed this after years now with this issue. At least Xcode 15.3 doesn't freeze for us. We can finally work reasonably well, after versions 13, 14 and 15 being absolutely awful.

A simple trick that works for us, you don't need to close and reopen Xcode, which will trigger resolving packages and such, you just need to kill XCBBuildService. I have a StreamDeck with a button just for this, so I can kill it and rebuild quickly. :unamused:

2 Likes

For me, this was happening for nearly every subsequent build (without prior Clean). So I ended up creating a build pre-action script for the scheme that I use with killall XCBBuildService.

4 Likes

That's a good one, beware though that it will also kill any other build that is currently running, so if you have two projects open at the same time it could be inconvenient.

1 Like

In Xcode 16 Beta it seems to have been fixed:

Fixed an issue where projects using SwiftPM build tool plugins would sometimes report internal inconsistency errors when building. (121851192) (FB13565986)

3 Likes