SwiftLint icon indicating copy to clipboard operation
SwiftLint copied to clipboard

Xcode 15 'Internal inconsistency error' when using as a Build Tool Plug-In

Open mattcorey opened this issue 1 year ago • 1 comments

New Issue Checklist

Describe the bug

When SwiftLint is configured to run as a Build Tool Plug-In, Xcode often throws an 'Internal inconsistency error' when building. At its worst, this error appears with every other build.

This has been discussed for some time on the Apple Developer Forums: https://forums.developer.apple.com/forums/thread/748062. The last two commenters (mine is the last one) indicate that this only started happening after adding SwiftLint as a Build Tool Plug-In.

To be clear, I have no idea if this is a SwiftLint bug or an Xcode bug, but I wanted to ensure that the SwiftLint team was aware of the issue.

Complete output when running SwiftLint, including the stack trace and command used

Xcode 15 error:

Internal inconsistency error: never received target ended message for target ID '19' (in target 'Bills To Budget' from project 'Bills To Budget'). Build again to continue.

Portion of the build output, exported from Xcode:

" /Users/mattcorey/Library/Developer/Xcode/DerivedData/Bills_To_Budget-cbwnqsglxcgitybqmwnmfikqrwvd/SourcePackages/artifacts/swiftlint/SwiftLintBinary/SwiftLintBinary.artifactbundle/swiftlint-0.55.1-macos/bin/swiftlint lint --quiet --force-exclude --cache-path /Users/mattcorey/Library/Developer/Xcode/DerivedData/Bills_To_Budget-cbwnqsglxcgitybqmwnmfikqrwvd/SourcePackages/plugins/Bills_To_Budget.output/UIComponents/SwiftLintBuildToolPlugin/Cache /Users/mattcorey/Developer/MoneyMaster/UIComponents/Budgets/BudgetSummaryBackground.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Expenses/ExpenseViewModel.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Expenses/PaymentLineView.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Expenses/ExpenseLineItemView.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Calendar/CalendarVisualizationModel.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Budgets/BudgetProgressChart.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Accounts/AccountTagView.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Budgets/BudgetSummaryView.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Extensions/Money+Transferable.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Extensions/View+ContrastingText.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/DeploymentEnvironmentSupport.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Accounts/AccountIconImage.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Calendar/CalendarEvent.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Expenses/ExpenseLine.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Extensions/View+SizePreferences.swift /Users/mattcorey/Developer/MoneyMaster/BillsToBudget/SwiftUI/Extensions/Date+Common.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Extensions/View+If.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Extensions/Locale+SFSymbols.swift /Users/mattcorey/Developer/MoneyMaster/UIComponents/Accounts/AccountGradient.swift

warning: Invalid configuration for 'force_try' rule. Falling back to default.
/Users/mattcorey/Developer/MoneyMaster/UIComponents/Calendar/CalendarVisualizationModel.swift:424:1: warning: File Length Violation: File should contain 400 lines or less: currently contains 424 (file_length)

Invalid configuration for 'force_try' rule. Falling back to default.

/Users/mattcorey/Developer/MoneyMaster/UIComponents/Calendar/CalendarVisualizationModel.swift:424:1: File Length Violation: File should contain 400 lines or less: currently contains 424 (file_length)

Process build tool plug-in results

Prepare build
error: Internal inconsistency error: never received target ended message for target ID '19' (in target 'Bills To Budget' from project 'Bills To Budget'). Build again to continue.


Internal inconsistency error: never received target ended message for target ID '19' (in target 'Bills To Budget' from project 'Bills To Budget'). Build again to continue.

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.55.1 - this differs from the version installed on my machine, but I assume this is not relevant?
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? Swift Package Manager
  • Paste your configuration file:
disabled_rules:
 - inclusive_language
 - line_length
 - identifier_name

opt_in_rules:
 - first_where

analyzer_rules:
 - unused_declaration
 - unused_import

force_try:
  excluded:
   - ".*Tests\\.swift"
  • Are you using nested configurations? No If so, paste their relative paths and respective contents.
  • Which Xcode version are you using (check xcodebuild -version)? 15.4
  • Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules to quickly test if your example is really demonstrating the issue. If your example is more complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.

It happens on every other Xcode build

mattcorey avatar Jun 07 '24 13:06 mattcorey

According to the Xcode 16 beta release notes.

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

DD-P avatar Jun 11 '24 00:06 DD-P