SwiftPM "could not find target(s)" in Package.swift in CI
SwiftPM validated the manifest graph and found a target, product, or dependency that names a target which is not declared. The names must match exactly, including case.
What this error means
swift build fails with "error: could not find target(s): X; mentioned in the package 'Y' dependencies" or a product listing a target that does not exist.
swift
error: could not find target(s): Utilities; mentioned in the package 'MyApp' dependenciesCommon causes
A typo or case mismatch in a target name
A .target(name:), .product, or dependencies: entry references a target whose spelling or case does not match the declared .target.
A target was removed or renamed but still referenced
A refactor renamed a target but a product or another target still lists the old name.
How to fix it
Make the referenced name match a declared target
- Find the target name in the error message.
- Confirm the exact spelling and case of the declared
.target(name:). - Update the dependency or product reference to match.
Package.swift
.target(name: "Utilities"),
.target(name: "MyApp", dependencies: ["Utilities"])Validate the manifest graph
Dump the parsed package to see the exact target and product names SwiftPM sees.
Terminal
swift package dump-package | grep -i nameHow to prevent it
- Keep target names consistent when refactoring the manifest.
- Run
swift package dump-packagein CI lint to catch dangling references. - Prefer defining names once and reusing them via variables where practical.
Related guides
SwiftPM "manifest parse error" in Package.swift in CIFix SwiftPM "error: manifest parse error" in CI - Package.swift failed to compile or evaluate, usually from a…
Swift "no such module 'X'" for an SPM dependency in CIFix Swift "error: no such module 'X'" in CI - the SPM dependency was not resolved or built before the source…
SwiftPM "the package manifest at '/Package.swift' cannot be accessed" in CIFix SwiftPM "error: the package manifest at '/Package.swift' cannot be accessed" in CI - swift build ran from…