Skip to content
Latchkey

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' dependencies

Common 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

  1. Find the target name in the error message.
  2. Confirm the exact spelling and case of the declared .target(name:).
  3. 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 name

How to prevent it

  • Keep target names consistent when refactoring the manifest.
  • Run swift package dump-package in CI lint to catch dangling references.
  • Prefer defining names once and reusing them via variables where practical.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →