{
  "id": "cicd/docker-buildkit-cache-mount",
  "signature": "failed to solve: failed to compute cache key: failed to calculate checksum of ref 'cache-mount-target': not found",
  "signature_zh": "解决失败：无法计算缓存键：无法计算引用'cache-mount-target'的校验和：未找到",
  "regex": "failed to compute cache key: failed to calculate checksum of ref.*not found",
  "domain": "cicd",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "Docker BuildKit cache mount target directory does not exist in the build context or base image, causing checksum calculation to fail when using `--mount=type=cache,target=/path` in a Dockerfile.",
  "root_cause_type": "generic",
  "root_cause_zh": "Docker BuildKit缓存挂载目标目录在构建上下文或基础镜像中不存在，导致在Dockerfile中使用`--mount=type=cache,target=/path`时校验和计算失败。",
  "versions": [
    {
      "version": "Docker 25.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "BuildKit 0.12.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Removing the cache mount will break the build if the cache is required for package downloads (e.g., apt, npm); the build may fail due to network timeouts or missing dependencies",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Disabling BuildKit removes cache mount support entirely, and the legacy builder may not support the same Dockerfile syntax, causing a different error",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Create the target directory in the Dockerfile before the cache mount is used: add `RUN mkdir -p /var/cache/apt` before the RUN instruction that uses `--mount=type=cache,target=/var/cache/apt`",
      "success_rate": 0.95,
      "how": "Create the target directory in the Dockerfile before the cache mount is used: add `RUN mkdir -p /var/cache/apt` before the RUN instruction that uses `--mount=type=cache,target=/var/cache/apt`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a different base image that already contains the cache directory, or ensure the directory is included in the build context by creating it locally before build",
      "success_rate": 0.85,
      "how": "Use a different base image that already contains the cache directory, or ensure the directory is included in the build context by creating it locally before build",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Create the target directory in the Dockerfile before the cache mount is used: add `RUN mkdir -p /var/cache/apt` before the RUN instruction that uses `--mount=type=cache,target=/var/cache/apt`",
    "Use a different base image that already contains the cache directory, or ensure the directory is included in the build context by creating it locally before build"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.docker.com/build/cache/",
  "official_doc_section": null,
  "error_code": "BUILDKIT_CACHE_MOUNT_NOT_FOUND",
  "verification_tier": "ai_generated",
  "confidence": 0.83,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-06-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}