{
  "id": "go/module-cache-lock-error",
  "signature": "go: failed to lock module cache: /home/user/go/pkg/mod/cache/download/lock: permission denied",
  "signature_zh": "go: 无法锁定模块缓存：/home/user/go/pkg/mod/cache/download/lock：权限被拒绝",
  "regex": "go:\\ failed\\ to\\ lock\\ module\\ cache:\\ /home/user/go/pkg/mod/cache/download/lock:\\ permission\\ denied",
  "domain": "go",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "The user does not have write permission to the module cache lock file, often due to running Go as a different user or in a restricted environment.",
  "root_cause_type": "generic",
  "root_cause_zh": "用户对模块缓存锁定文件没有写权限，通常是由于以不同用户身份运行 Go 或在受限环境中运行。",
  "versions": [
    {
      "version": "1.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.13",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.14",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.15",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.16",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.17",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.18",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.19",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.23",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Running 'sudo go build' to bypass permissions",
      "why_fails": "Running Go as root can cause ownership issues and security risks; may also not resolve if the cache is owned by another user.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Deleting the lock file manually",
      "why_fails": "The lock file is managed by Go; deletion may cause race conditions or corruption.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Change ownership of the module cache to the current user",
      "success_rate": 0.9,
      "how": "sudo chown -R $(whoami) $(go env GOMODCACHE)",
      "condition": "",
      "sources": []
    },
    {
      "action": "Set GOMODCACHE to a writable directory",
      "success_rate": 0.85,
      "how": "export GOMODCACHE=/tmp/gomodcache && go mod download",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-11-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}