What does this dependency resolution error mean?

you are right, this was specifically triggered by pinning SwiftSyntax to a prerelease version in root package. this also happens when pinning SwiftSyntax to the normal release version, as would be done if the package has macros, but this is less surprising as swift-testing explicitly requires a prerelease version of SwiftSyntax.

that gave me the idea to try a range version where one of the bounds is a pre-release version:

.package(url: "https://github.com/apple/swift-syntax", 
    "510.0.1" ..< "601.0.0-pre"),

but then there is an internal error:

error: InternalError(description: "Internal error. Please file a bug at https://github.com/apple/swift-package-manager/issues with this info. Expected root cause {swift-dom[everything] 1.0.1, ¬swift-syntax[everything] 510.0.1..<601.0.0} to almost satisfy the current partial solution:\n * [Decision 0: dependency-test[everything] 1.0.0]\n * [Derivation: swift-syntax[everything] 510.0.1..<601.0.0-pre ← {dependency-test[everything] 1.0.0, ¬swift-syntax[everything] 510.0.1..<601.0.0-pre}]\n * [Derivation: swift-testing[everything] 0.9.0..<0.10.0 ← {dependency-test[everything] 1.0.0, ¬swift-testing[everything] 0.9.0..<0.10.0}]\n * [Derivation: swift-system[everything] 1.3.0..<2.0.0 ← {dependency-test[everything] 1.0.0, ¬swift-system[everything] 1.3.0..<2.0.0}]\n * [Derivation: swift-markdown[everything] 0.3.0..<0.4.0 ← {dependency-test[everything] 1.0.0, ¬swift-markdown[everything] 0.3.0..<0.4.0}]\n * [Derivation: swift-nio-http2[everything] 1.31.0..<2.0.0 ← {dependency-test[everything] 1.0.0, ¬swift-nio-http2[everything] 1.31.0..<2.0.0}]\n * [Derivation: swift-nio-ssl[everything] 2.26.0..<3.0.0 ← {dependency-test[everything] 1.0.0, ¬swift-nio-ssl[everything] 2.26.0..<3.0.0}]\n * [Derivation: swift-nio[everything] 2.65.0..<3.0.0 ← {dependency-test[everything] 1.0.0, ¬swift-nio[everything] 2.65.0..<3.0.0}]\n * [Derivation: swift-collections[everything] 1.1.0..<2.0.0 ← {dependency-test[everything] 1.0.0, ¬swift-collections[everything] 1.1.0..<2.0.0}]\n * [Derivation: swift-atomics[everything] 1.2.0..<2.0.0 ← {dependency-test[everything] 1.0.0, ¬swift-atomics[everything] 1.2.0..<2.0.0}]\n * [Derivation: swift-png[everything] 4.4.3..<4.5.0 ← {dependency-test[everything] 1.0.0, ¬swift-png[everything] 4.4.3..<4.5.0}]\n * [Derivation: swift-json[everything] 1.1.0..<1.2.0 ← {dependency-test[everything] 1.0.0, ¬swift-json[everything] 1.1.0..<1.2.0}]\n * [Derivation: swift-mongodb[everything] 0.18.1..<0.19.0 ← {dependency-test[everything] 1.0.0, ¬swift-mongodb[everything] 0.18.1..<0.19.0}]\n * [Derivation: swift-hash[everything] 0.6.0..<0.7.0 ← {dependency-test[everything] 1.0.0, ¬swift-hash[everything] 0.6.0..<0.7.0}]\n * [Derivation: swift-grammar[everything] 0.4.0..<0.5.0 ← {dependency-test[everything] 1.0.0, ¬swift-grammar[everything] 0.4.0..<0.5.0}]\n * [Derivation: swift-dom[everything] 1.0.1..<1.1.0 ← {dependency-test[everything] 1.0.0, ¬swift-dom[everything] 1.0.1..<1.1.0}]\n * [Derivation: ¬swift-dom[everything] 1.0.2..<1.1.0 ← {swift-dom[everything] 1.0.2..<1.1.0}]\n")

here is a manifest that causes the error:

// swift-tools-version: 5.10

import PackageDescription

let package = Package(
    name: "dependency-test",
    products: [],
    dependencies: [
        .package(url: "https://github.com/tayloraswift/swift-dom", .upToNextMinor(from: "1.0.1")),
        .package(url: "https://github.com/apple/swift-testing", .upToNextMinor(from: "0.9.0")),
        .package(url: "https://github.com/apple/swift-syntax", "510.0.1" ..< "601.0.0-pre"),
    ],
    targets: []
)

and the error for the reduced case

error: InternalError(description: "Internal error. Please file a bug at https://github.com/apple/swift-package-manager/issues with this info. Expected root cause {swift-dom[everything] 1.0.1, ¬swift-syntax[everything] 510.0.1..<601.0.0} to almost satisfy the current partial solution:\n * [Decision 0: dependency-test[everything] 1.0.0]\n * [Derivation: swift-syntax[everything] 510.0.1..<601.0.0-pre ← {dependency-test[everything] 1.0.0, ¬swift-syntax[everything] 510.0.1..<601.0.0-pre}]\n * [Derivation: swift-testing[everything] 0.9.0..<0.10.0 ← {dependency-test[everything] 1.0.0, ¬swift-testing[everything] 0.9.0..<0.10.0}]\n * [Derivation: swift-dom[everything] 1.0.1..<1.1.0 ← {dependency-test[everything] 1.0.0, ¬swift-dom[everything] 1.0.1..<1.1.0}]\n * [Derivation: ¬swift-dom[everything] 1.0.2..<1.1.0 ← {swift-dom[everything] 1.0.2..<1.1.0}]\n")

i also filed the issue here: InternalError: Expected root cause · Issue #7643 · apple/swift-package-manager · GitHub

1 Like