cicd
config_error
ai_generated
true
警告:未找到键 'node-modules-v1-abc123' 的缓存 'node-modules-v1'。正在从回退中恢复。
Warning: Cache 'node-modules-v1' not found for key 'node-modules-v1-abc123'. Restoring from fallback.
ID: cicd/bitbucket-pipeline-artifact-cache-key-mismatch
80%修复率
85%置信度
1证据数
2024-04-12首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Bitbucket Pipelines 2.0+ | active | — | — | — |
| bitbucket-pipelines.yml schema v2 | active | — | — | — |
根因分析
Bitbucket Pipelines 无法找到给定键的缓存条目,因为缓存被逐出、键格式已更改,或由于步骤失败而从未创建缓存。
English
Bitbucket Pipelines cannot find a cache entry for the given key because the cache was evicted, the key format has changed, or the cache was never created due to a failed step.
官方文档
https://support.atlassian.com/bitbucket-cloud/docs/cache-dependencies/解决方案
-
Update the cache key in bitbucket-pipelines.yml to use a dynamic hash based on the lock file: `caches: node-modules: key: node-modules-v1-{{ checksum "package-lock.json" }}` -
Add a fallback cache key to restore from a previous cache: `caches: node-modules: key: node-modules-v1-{{ checksum "package-lock.json" }} restore-keys: node-modules-v1-`
无效尝试
常见但无效的做法:
-
Increasing the cache size limit in the pipeline settings without changing the cache key
50% 失败
The cache key mismatch is unrelated to size; it's a key generation issue that requires updating the cache key format in the YAML.
-
Manually deleting the cache from the Bitbucket UI and hoping a new one is created automatically
70% 失败
Deleting the cache does not trigger a new cache creation; the pipeline must be re-run with a valid cache step to generate a new entry.