{
  "id": "pytorch/compiler-cache-corruption",
  "signature": "RuntimeError: torch.compile cache corrupted: invalid key hash for compiled module",
  "signature_zh": "RuntimeError：torch.compile缓存损坏：编译模块的键哈希无效",
  "regex": "torch.compile cache corrupted|invalid key hash for compiled module",
  "domain": "pytorch",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The on-disk cache directory for torch.compile (default ~/.cache/torch/compile) contains stale or corrupted files due to version mismatch or incomplete writes.",
  "root_cause_type": "generic",
  "root_cause_zh": "torch.compile的磁盘缓存目录（默认~/.cache/torch/compile）包含因版本不匹配或写入不完整而导致的陈旧或损坏文件。",
  "versions": [
    {
      "version": "torch>=2.1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "torch>=2.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The cache is stored in user home directory, not in the package installation; reinstalling doesn't clear it.",
      "fail_rate": 0.98,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Debug mode only prints information but doesn't fix the corruption.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Clear the torch.compile cache: rm -rf ~/.cache/torch/compile/",
      "success_rate": 0.99,
      "how": "Clear the torch.compile cache: rm -rf ~/.cache/torch/compile/",
      "condition": "",
      "sources": []
    },
    {
      "action": "Disable caching entirely: torch._dynamo.config.cache_size_limit = 0",
      "success_rate": 0.95,
      "how": "Disable caching entirely: torch._dynamo.config.cache_size_limit = 0",
      "condition": "",
      "sources": []
    },
    {
      "action": "Set a different cache directory: export TORCH_COMPILE_CACHE_DIR=/tmp/torch_cache",
      "success_rate": 0.9,
      "how": "Set a different cache directory: export TORCH_COMPILE_CACHE_DIR=/tmp/torch_cache",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Clear the torch.compile cache: rm -rf ~/.cache/torch/compile/",
    "Disable caching entirely: torch._dynamo.config.cache_size_limit = 0",
    "Set a different cache directory: export TORCH_COMPILE_CACHE_DIR=/tmp/torch_cache"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://pytorch.org/docs/stable/compile/caching.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-03-01",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}