# Warning: Cache 'node-modules-v1' not found for key 'node-modules-v1-abc123'. Restoring from fallback.

- **ID:** `cicd/bitbucket-pipeline-artifact-cache-key-mismatch`
- **Domain:** cicd
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

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.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Bitbucket Pipelines 2.0+ | active | — | — |
| bitbucket-pipelines.yml schema v2 | active | — | — |

## Workarounds

1. **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" }}`** (80% success)
   ```
   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" }}`
   ```
2. **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-`** (90% success)
   ```
   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-`
   ```

## Dead Ends

- **Increasing the cache size limit in the pipeline settings without changing the cache key** — The cache key mismatch is unrelated to size; it's a key generation issue that requires updating the cache key format in the YAML. (50% fail)
- **Manually deleting the cache from the Bitbucket UI and hoping a new one is created automatically** — 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. (70% fail)
