# ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref moby::abc123: "/some/path": not found

- **ID:** `cicd/docker-buildkit-cache-mount-error`
- **Domain:** cicd
- **Category:** build_error
- **Error Code:** `BUILDKIT_CACHE_MOUNT`
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

Docker BuildKit cache mount target path does not exist or is invalid, often due to a missing directory in the build context or a typo in the --mount=type=cache,target= path.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Docker 24.0.5 | active | — | — |
| Docker 25.0.0 | active | — | — |
| BuildKit v0.12.0 | active | — | — |

## Workarounds

1. **Ensure the cache mount target directory exists in the Dockerfile by adding a RUN mkdir -p /some/path before the cache mount instruction.** (95% success)
   ```
   Ensure the cache mount target directory exists in the Dockerfile by adding a RUN mkdir -p /some/path before the cache mount instruction.
   ```
2. **Use absolute paths and avoid symlinks: change --mount=type=cache,target=/var/cache/apt to a unique path like /cache/apt and ensure no trailing spaces.** (85% success)
   ```
   Use absolute paths and avoid symlinks: change --mount=type=cache,target=/var/cache/apt to a unique path like /cache/apt and ensure no trailing spaces.
   ```

## Dead Ends

- **** — Running docker system prune -a removes all cache but doesn't fix the underlying path issue; cache mounts still fail. (90% fail)
- **** — Adding --no-cache flag forces rebuild but doesn't address the missing directory; error persists on next build. (80% fail)
- **** — Changing the cache mount from type=cache to type=bind may work but defeats caching purpose and can cause permission issues. (50% fail)
