`failed to solve: snapshot does not exist: not found` when updating from `v0.9.3` to `v0.10.3`
Context
I was running buildkit in rootless mode from tag v0.9.3 and upgraded to v0.10.3 (also rootless).
Problem
The first time building an image, I get the following error:
failed to solve: snapshot does not exist: not found
Note the 2 spaces between snapshot and does.
Steps to reproduce
- delete buildkit's cache
- set buildkit's version to
v0.9.3rootless - build a bunch of images
- set buildkit's version to
v0.10.3rootless - build another image (this should give the error)
Additional information
Debugging, I found that this error arises here, in the containerd module and it's due to the snapshot key string being empty (thus the 2 spaces in the error message). Going deeper in the stacktrace I found that the key is empty from here. Adding some prints I've seen that here it's searching for cache.snapshot in
map[cache.cachePolicy:0xc000a660c0 cache.createdAt:0xc000a66180 cache.description:0xc000a66240 cache.lastUsedAt:0xc000a66300 cache.recordType:0xc000a663c0 cache.usageCount:0xc000a66450 local.sharedKey:dockerfile:dockerfile::0xc000a66540]
and it doesn't find it. I don't know how the s.values map is being filled, but it seems like it has a problem with changing versions without deleting cache
This seems to be a cache problem because:
- The error doesn't occur if I clear
buildkit's cache - The error only happens a few times before it goes away (and other weird new ones start to occur)
Please guide me if there's more information I can provide. Thanks for your time :)
I've seen this on desktop (4.10.1) with docker-container driver, seemed possibly related to an upgrade. Disabling cache got me past the error.