Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal inconsistency error (didStartTask) #15

Open
markst opened this issue Jul 4, 2023 · 7 comments
Open

Internal inconsistency error (didStartTask) #15

markst opened this issue Jul 4, 2023 · 7 comments

Comments

@markst
Copy link

markst commented Jul 4, 2023

Issue Description

Summary:
SwiftGenPlugin causes Xcode to display a build error with the following message:

Internal inconsistency error (didStartTask): targetID (174) not found in _activeTargets.
Internal inconsistency error (didEndTask): '12' missing from _activeTasks.

Issue Details:
The build error described above occurs sporadically and seemingly without any specific trigger. This issue is solely related to Xcode and can be quite frustrating as it distracts developers from focusing on their code. To resolve the issue temporarily, quitting and re-launching Xcode is sufficient.

The problem seems to arise when a change is made to the build plan, such as adding a file, or when initiating a build while Xcode is in an unfortunate indexing stage. This causes Xcode's build cache to become scrambled, resulting in subsequent build failures without any error indication. As a result, the product being built remains stale, and it silently launches outdated code.

The issue persists indefinitely until Xcode is re-initialized. This can be achieved by re-launching Xcode or by performing actions like building for a different target platform or updating a dependency. These actions sometimes fortuitously clear the necessary cache portion, allowing the build to proceed successfully.

This issue affects developers using the SwiftGenPlugin in Xcode and hampers productivity due to the need for frequent manual intervention. A more stable solution or workaround is required to prevent this build error from occurring.

Steps to Reproduce:

  1. Install and configure SwiftGenPlugin in Xcode.
  2. Make changes to the build plan, such as adding a file, or start a build during Xcode's indexing stage.
  3. Observe the build error message:
Internal inconsistency error (didStartTask): targetID (174) not found in _activeTargets.
Internal inconsistency error (didEndTask): '12' missing from _activeTasks.

Expected Behavior:
The build process should complete successfully without any internal inconsistency errors.

Actual Behavior:
Xcode displays the internal inconsistency error message and subsequent builds fail to produce the expected result, launching stale products instead.

Environment:

  • Xcode version: 14.3.0
  • SwiftGenPlugin version: 6.6.2
  • Operating system: Ventura 13.4

image

https://forums.swift.org/t/internal-inconsistency-error-didstarttask/61194/1

@roddymunro
Copy link

I see this too. A clean build seems to fix it temporarily.

Chlup added a commit to Chlup/secant-ios-wallet that referenced this issue Sep 22, 2023
Unfortunatelly swiftgen SPM plugin has multiple issues with Xcode 15.
For now swiftgen execution must be switched to the build phase scripts.

Issues:
- SwiftGen/SwiftGenPlugin#14
- SwiftGen/SwiftGenPlugin#15
LukasKorba pushed a commit to LukasKorba/secant-ios-wallet that referenced this issue Sep 25, 2023
Unfortunatelly swiftgen SPM plugin has multiple issues with Xcode 15.
For now swiftgen execution must be switched to the build phase scripts.

Issues:
- SwiftGen/SwiftGenPlugin#14
- SwiftGen/SwiftGenPlugin#15
@Svantulden
Copy link

I've seen this problem as well in my project with a local SPM package that uses this SwiftGen plugin.

On Xcode 15.1 Beta 3 this issue now actually fails the build with Build Failed, so doesn't produce stale builds anymore. The error messages are also more elaborate:

Internal inconsistency error: received multiple target ended messages for target ID '1' or received target ended message but did not receive corresponding target started message, while retrieving parent activity in taskStarted message.

together with

Internal inconsistency error: received multiple task ended messages for task ID '4' or received task ended message but did not receive corresponding task started message.

Though I've got no idea how to prevent this error yet...

@shatodj
Copy link

shatodj commented Mar 7, 2024

XCode 15.3 just came out and the message has changed:

unexpected service error: The Xcode build system has terminated due to an error. Build again to continue.

Internal inconsistency error: never received task ended message for task ID '6' with rule info 'SwiftEmitModule normal arm64 Emitting\ module\ for\ UI'. Build again to continue.

Internal inconsistency error: never received target ended message for target ID '122' (in target 'UI' from project 'UI'). Build again to continue.

It says Build again to continue. So clearing the build folder is unnecessary.

@dfed
Copy link

dfed commented May 19, 2024

This is not an issue with SwiftGen. It's an issue with Xcode. Please file Feedback requests to Apple so they prioritize this.

@LeoNatan
Copy link

Please file Feedback requests to Apple so they prioritize this.

I don't think writing more and more stuff to /dev/null actually increases visibility of said stuff.

@markst
Copy link
Author

markst commented May 21, 2024

Appreciate this is an Xcode bug and not to do with SwiftGen.

There is a comment on swift.org forum which suggests adding a pre-action script to killall XCBBuildService
https://forums.swift.org/t/internal-inconsistency-error-didstarttask/61194/34

@shatodj
Copy link

shatodj commented Jun 26, 2024

https://developer.apple.com/documentation/xcode-release-notes/xcode-16-release-notes

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants