swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.75k stars 1.35k forks source link

[SR-11338] Package resolution fails with "the Package.resolved file is most likely severely out-of-date and is preventing correct resolution; delete the resolved file and try again" #4673

Open swift-ci opened 5 years ago

swift-ci commented 5 years ago
Previous ID SR-11338
Radar rdar://problem/54556059
Original Reporter rafiki270 (JIRA User)
Type Bug

Attachment: Download

Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Package Manager | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 5be4cc4f9548adbad0d6d1262b52526c

Issue Description:

After upgrading to Catalina beta 6 and Xcode beta 6 I am no longer able to use SPM on my project although it seems the graph gets resolved.

The result is an un-actionable error ` the Package.resolved file is most likely severely out-of-date and is preventing correct resolution; delete the resolved file and try again`

I have tried to delete the resolved file as well as .build, .swiftpm and the whole of derived data with no luck between tests.

It is currently happening on the latest commit of our project here:
https://github.com/Einstore/Speedster/commit/d06f228cdcd866d51b5f31e8d4fe7197ac88286f

Edit: I have tried to reference a local package at one point after after installing Xcode 11 beta 6 which would fit scenario described in https://bugs.swift.org/browse/SR-11032 but had since removed that and the issue persists so assume this problem might not be related.

The normal build log looks like this:

➜  Speedster git:(master) ✗ swift build                          
Fetching https://github.com/vapor/fluent-postgres-driver.git
Fetching https://github.com/vapor/jobs-redis-driver.git
Fetching https://github.com/vapor/redis-kit.git
Fetching https://github.com/apple/swift-metrics.git
Fetching https://github.com/vapor/postgres-kit.git
Fetching https://github.com/apple/swift-nio-ssl.git
Fetching https://github.com/Einstore/Systemator.git
Fetching https://github.com/swift-server/async-http-client.git
Fetching https://github.com/Einstore/ShellKit.git
Fetching https://github.com/Einstore/GitHubKit.git
Fetching https://github.com/vapor/postgres-nio.git
Fetching https://github.com/apple/swift-nio.git
Fetching https://github.com/vapor/open-crypto.git
Fetching https://github.com/Einstore/NIOErrorKit.git
Fetching https://github.com/vapor/fluent-kit.git
Fetching https://github.com/apple/swift-nio-http2.git
Fetching https://github.com/vapor/sql-kit.git
Fetching https://github.com/vapor/fluent-sqlite-driver.git
Fetching https://github.com/apple/swift-nio-extras.git
Fetching https://github.com/vapor/sqlite-nio.git
Fetching https://gitlab.com/mordil/swift-redi-stack.git
Fetching https://github.com/IBM-Swift/BlueSocket
Fetching https://github.com/vapor/console-kit.git
Fetching https://github.com/vapor/async-kit.git
Fetching https://github.com/Einstore/SecretsKit.git
Fetching https://github.com/Einstore/VaporErrorKit.git
Fetching https://github.com/vapor/redis.git
Fetching https://github.com/Einstore/WebErrorKit.git
Fetching https://github.com/rafiki270/Yams.git
Fetching https://github.com/vapor/crypto-kit.git
Fetching https://github.com/vapor/routing-kit.git
Fetching https://github.com/Einstore/Shout.git
Fetching https://github.com/vapor/sqlite-kit.git
Fetching https://github.com/vapor/fluent.git
Fetching https://github.com/jakeheis/CSSH
Fetching https://github.com/vapor/vapor.git
Fetching https://github.com/vapor/jobs.git
Fetching https://github.com/apple/swift-log.git
Completed resolution in 39.04s
Cloning https://github.com/apple/swift-metrics.git
Resolving https://github.com/apple/swift-metrics.git at 1.1.0
Cloning https://github.com/vapor/console-kit.git
Resolving https://github.com/vapor/console-kit.git at 4.0.0-alpha.1
Cloning https://github.com/vapor/postgres-nio.git
Resolving https://github.com/vapor/postgres-nio.git at 1.0.0-alpha.1.4
Cloning https://github.com/vapor/sqlite-nio.git
Resolving https://github.com/vapor/sqlite-nio.git at 1.0.0-alpha.1.1
Cloning https://github.com/vapor/sql-kit.git
Resolving https://github.com/vapor/sql-kit.git at 3.0.0-alpha.1.3
Cloning https://github.com/vapor/fluent-kit.git
Resolving https://github.com/vapor/fluent-kit.git at 1.0.0-alpha.3
Cloning https://github.com/vapor/sqlite-kit.git
Resolving https://github.com/vapor/sqlite-kit.git at 4.0.0-alpha.1.1
Cloning https://github.com/vapor/fluent-postgres-driver.git
Resolving https://github.com/vapor/fluent-postgres-driver.git at 2.0.0-alpha.3
Cloning https://github.com/vapor/redis-kit.git
Resolving https://github.com/vapor/redis-kit.git at 1.0.0-alpha.2
Cloning https://github.com/Einstore/Systemator.git
Resolving https://github.com/Einstore/Systemator.git at 0.0.6
Cloning https://github.com/rafiki270/Yams.git
Resolving https://github.com/rafiki270/Yams.git at master
Cloning https://github.com/vapor/open-crypto.git
Resolving https://github.com/vapor/open-crypto.git at 4.0.0-alpha.2
Cloning https://github.com/vapor/async-kit.git
Resolving https://github.com/vapor/async-kit.git at 1.0.0-alpha.1
Cloning https://github.com/Einstore/SecretsKit.git
Resolving https://github.com/Einstore/SecretsKit.git at 1.0.0
Cloning https://github.com/Einstore/Shout.git
Resolving https://github.com/Einstore/Shout.git at 0.5.1
Cloning https://gitlab.com/mordil/swift-redi-stack.git
Resolving https://gitlab.com/mordil/swift-redi-stack.git at 1.0.0-alpha.5.0.2
Cloning https://github.com/vapor/redis.git
Resolving https://github.com/vapor/redis.git at 4.0.0-alpha.1
Cloning https://github.com/vapor/routing-kit.git
Resolving https://github.com/vapor/routing-kit.git at 4.0.0-alpha.1
Cloning https://github.com/vapor/postgres-kit.git
Resolving https://github.com/vapor/postgres-kit.git at 2.0.0-alpha.2
Cloning https://github.com/vapor/vapor.git
Resolving https://github.com/vapor/vapor.git at 4.0.0-alpha.2
Cloning https://github.com/vapor/jobs-redis-driver.git
Resolving https://github.com/vapor/jobs-redis-driver.git at 1.0.0-alpha.2
Cloning https://github.com/vapor/fluent.git
Resolving https://github.com/vapor/fluent.git at 4.0.0-alpha.2
Cloning https://github.com/apple/swift-nio-extras.git
Resolving https://github.com/apple/swift-nio-extras.git at 1.2.0
Cloning https://github.com/apple/swift-nio-ssl.git
Resolving https://github.com/apple/swift-nio-ssl.git at 2.4.0
Cloning https://github.com/apple/swift-nio-http2.git
Resolving https://github.com/apple/swift-nio-http2.git at 1.5.0
Cloning https://github.com/jakeheis/CSSH
Resolving https://github.com/jakeheis/CSSH at 1.0.3
Cloning https://github.com/vapor/fluent-sqlite-driver.git
Resolving https://github.com/vapor/fluent-sqlite-driver.git at 4.0.0-alpha.3
Cloning https://github.com/apple/swift-nio.git
Resolving https://github.com/apple/swift-nio.git at 2.7.0
Cloning https://github.com/vapor/jobs.git
Resolving https://github.com/vapor/jobs.git at 1.0.0-alpha.2.2
Cloning https://github.com/IBM-Swift/BlueSocket
Resolving https://github.com/IBM-Swift/BlueSocket at 1.0.48
Cloning https://github.com/Einstore/NIOErrorKit.git
Resolving https://github.com/Einstore/NIOErrorKit.git at 0.0.1
Cloning https://github.com/vapor/crypto-kit.git
Resolving https://github.com/vapor/crypto-kit.git at 4.0.0-alpha.2
Cloning https://github.com/swift-server/async-http-client.git
Resolving https://github.com/swift-server/async-http-client.git at 1.0.0-alpha.1
Cloning https://github.com/apple/swift-log.git
Resolving https://github.com/apple/swift-log.git at 1.1.1
Cloning https://github.com/Einstore/WebErrorKit.git
Resolving https://github.com/Einstore/WebErrorKit.git at 0.0.1
Cloning https://github.com/Einstore/GitHubKit.git
Resolving https://github.com/Einstore/GitHubKit.git at 1.6.5
Cloning https://github.com/Einstore/ShellKit.git
Resolving https://github.com/Einstore/ShellKit.git at 1.5.1
Cloning https://github.com/Einstore/VaporErrorKit.git
Resolving https://github.com/Einstore/VaporErrorKit.git at 0.0.1
Updating https://github.com/apple/swift-metrics.git
Updating https://github.com/IBM-Swift/BlueSocket
Updating https://github.com/swift-server/async-http-client.git
Updating https://github.com/vapor/crypto-kit.git
Updating https://github.com/vapor/vapor.git
Updating https://github.com/Einstore/GitHubKit.git
Updating https://github.com/vapor/jobs-redis-driver.git
Updating https://github.com/Einstore/SecretsKit.git
Updating https://github.com/apple/swift-nio-extras.git
Updating https://github.com/vapor/routing-kit.git
Updating https://github.com/vapor/open-crypto.git
Updating https://github.com/Einstore/ShellKit.git
Updating https://github.com/vapor/jobs.git
Updating https://github.com/vapor/console-kit.git
Updating https://github.com/vapor/sqlite-kit.git
Updating https://github.com/rafiki270/Yams.git
Updating https://github.com/Einstore/VaporErrorKit.git
Updating https://github.com/vapor/redis.git
Updating https://github.com/vapor/sql-kit.git
Updating https://github.com/Einstore/Shout.git
Updating https://github.com/vapor/postgres-nio.git
Updating https://github.com/vapor/async-kit.git
Updating https://github.com/vapor/fluent-kit.git
Updating https://github.com/vapor/redis-kit.git
Updating https://github.com/vapor/fluent-postgres-driver.git
Updating https://github.com/vapor/fluent-sqlite-driver.git
Updating https://github.com/apple/swift-log.git
Updating https://github.com/vapor/fluent.git
Updating https://github.com/apple/swift-nio.git
Updating https://github.com/jakeheis/CSSH
Updating https://github.com/vapor/postgres-kit.git
Updating https://github.com/Einstore/WebErrorKit.git
Updating https://github.com/Einstore/NIOErrorKit.git
Updating https://github.com/apple/swift-nio-ssl.git
Updating https://github.com/Einstore/Systemator.git
Updating https://github.com/apple/swift-nio-http2.git
Updating https://github.com/vapor/sqlite-nio.git
Updating https://gitlab.com/mordil/swift-redi-stack.git
Completed resolution in 22.93s
Everything is already up-to-date
error: the Package.resolved file is most likely severely out-of-date and is preventing correct resolution; delete the resolved file and try again

In xcode I get (with dependencies being fetched multiple times and all of them showing in the left column as resolved but with no schema generated and the same error from Package loading action):

Showing Recent Messages
Update Package Graph

Activity Log Complete    21/08/2019, 02:41    153.2 seconds
(screenshot attached)

I have also been suggested to use a new resolver (of which I don't know much about) which gave me:

➜  Speedster git:(testable-github) ✗ swift build --enable-pubgrub-resolver
Updating https://github.com/vapor/open-crypto.git
Updating https://github.com/vapor/routing-kit.git
Updating https://github.com/Einstore/WebErrorKit.git
Updating https://github.com/apple/swift-nio-http2.git
Updating https://github.com/vapor/postgres-kit.git
Updating https://github.com/jakeheis/CSSH
Updating https://github.com/swift-server/async-http-client.git
Updating https://github.com/vapor/jobs-redis-driver.git
Updating https://github.com/apple/swift-metrics.git
Updating https://github.com/vapor/crypto-kit.git
Updating https://github.com/apple/swift-nio-ssl.git
Updating https://github.com/Einstore/Systemator.git
Updating https://github.com/vapor/sqlite-nio.git
Updating https://github.com/vapor/jobs.git
Updating https://github.com/Einstore/Shout.git
Updating https://github.com/Einstore/GitHubKit.git
Updating https://github.com/vapor/fluent.git
Updating https://github.com/rafiki270/Yams.git
Updating https://github.com/Einstore/NIOErrorKit.git
Updating https://github.com/IBM-Swift/BlueSocket
Updating https://github.com/vapor/postgres-nio.git
Updating https://github.com/vapor/sqlite-kit.git
Updating https://github.com/vapor/fluent-sqlite-driver.git
Updating https://gitlab.com/mordil/swift-redi-stack.git
Updating https://github.com/Einstore/SecretsKit.git
Updating https://github.com/vapor/fluent-kit.git
Updating https://github.com/apple/swift-nio.git
Updating https://github.com/vapor/redis-kit.git
Updating https://github.com/vapor/async-kit.git
Updating https://github.com/apple/swift-log.git
Updating https://github.com/Einstore/ShellKit.git
Updating https://github.com/Einstore/VaporErrorKit.git
Updating https://github.com/vapor/redis.git
Updating https://github.com/vapor/console-kit.git
Updating https://github.com/vapor/vapor.git
Updating https://github.com/apple/swift-nio-extras.git
Updating https://github.com/vapor/fluent-postgres-driver.git
Updating https://github.com/vapor/sql-kit.git
Completed resolution in 45.39s
Everything is already up-to-date
Updating https://github.com/Einstore/ShellKit.git
Updating https://github.com/vapor/async-kit.git
Updating https://github.com/Einstore/NIOErrorKit.git
Updating https://github.com/vapor/console-kit.git
Updating https://github.com/rafiki270/Yams.git
Updating https://github.com/Einstore/VaporErrorKit.git
Updating https://gitlab.com/mordil/swift-redi-stack.git
Updating https://github.com/apple/swift-log.git
Updating https://github.com/vapor/fluent-postgres-driver.git
Updating https://github.com/vapor/jobs.git
Updating https://github.com/vapor/vapor.git
Updating https://github.com/vapor/fluent.git
Updating https://github.com/Einstore/GitHubKit.git
Updating https://github.com/vapor/fluent-kit.git
Updating https://github.com/vapor/postgres-kit.git
Updating https://github.com/apple/swift-nio-ssl.git
Updating https://github.com/Einstore/SecretsKit.git
Updating https://github.com/apple/swift-nio-http2.git
Updating https://github.com/vapor/postgres-nio.git
Updating https://github.com/vapor/fluent-sqlite-driver.git
Updating https://github.com/Einstore/Shout.git
Updating https://github.com/vapor/crypto-kit.git
Updating https://github.com/Einstore/WebErrorKit.git
Updating https://github.com/apple/swift-nio-extras.git
Updating https://github.com/vapor/sql-kit.git
Updating https://github.com/vapor/redis.git
Updating https://github.com/IBM-Swift/BlueSocket
Updating https://github.com/vapor/open-crypto.git
Updating https://github.com/vapor/redis-kit.git
Updating https://github.com/vapor/sqlite-nio.git
Updating https://github.com/Einstore/Systemator.git
Updating https://github.com/apple/swift-nio.git
Updating https://github.com/vapor/routing-kit.git
Updating https://github.com/swift-server/async-http-client.git
Updating https://github.com/vapor/sqlite-kit.git
Updating https://github.com/apple/swift-metrics.git
Updating https://github.com/vapor/jobs-redis-driver.git
Updating https://github.com/jakeheis/CSSH
Completed resolution in 41.98s
Everything is already up-to-date
error: the Package.resolved file is most likely severely out-of-date and is preventing correct resolution; delete the resolved file and try again
weissi commented 5 years ago

@aciidb0mb3r here's a one-line repro:

rm -rf /tmp/{Speedster,GitHubKit} && cd /tmp && git clone https://github.com/Einstore/GitHubKit && git clone https://github.com/Einstore/Speedster.git && cd Speedster && git reset --hard d06f228cdcd866d51b5f31e8d4fe7197ac88286f && sed -i '' 's#https://github.com/Einstore/GitHubKit.git", from: "1.0.0"#../GitHubKit", .branch("master")#g' Package.swift && swift build

Changing the dependency from from: "1.0.0" to .branch("master") seems necessary to trigger the issue.

Weirdly though, if it failed once, it'll fail again, even if you put from: "1.0.0" back. Oddly even after rm -rf .build Package.resolved ...

weissi commented 5 years ago

@swift-ci create

tomerd commented 3 years ago

The root cause here is that the project pulls in a dependency on “https://github.com/vapor/jobs.git” and “https://github.com/vapor/jobs-redis-driver.git” which have been renamed to “https://github.com/vapor/queues.git” and “https://github.com/vapor/queues-redis-driver.git” respectively, and “https://github.com/vapor/queues-redis-driver.git” is pulling “https://github.com/vapor/queues.git”.

Since both “https://github.com/vapor/jobs.git” and “https://github.com/vapor/queues.git” resolve to the same repo, the name in the manifest is the same which is tripping the logic in SwiftPM that filters duplicate manifests, resulting in a non-resolvable graph.

The original error message (“the Package.resolved file is most likely severely out-of-date and is preventing correct resolution; delete the resolved file and try again”) is of course misleading and was fixed (in another radar) to include information about the problematic dependencies (in this case https://github.com/vapor/queues.git)

We also looking to change the logic in SwiftPM so it filters manifest based on identity (url based for now) instead of name which should improve the experience by giving more actionable errors like missing products or duplicate products

swift-ci commented 3 years ago

Comment by Jason Wray (JIRA)

Tom's improvements should be available in the Xcode 12.5 betas and Swift 5.4 development snapshot toolchains — please give those a try and let us know if this isn't resolved. Thanks!