{
  "id": "go/module-declares-path-but-required-as",
  "signature": "go: github.com/foo/bar@v1.2.3: parsing go.mod:\n\tmodule declares its path as: github.com/foo/baz\n\t        but was required as: github.com/foo/bar",
  "signature_zh": "go: github.com/foo/bar@v1.2.3: 解析 go.mod 出错：\n\t模块声明的路径为: github.com/foo/baz\n\t        但被引用为: github.com/foo/bar",
  "regex": "go:\\ github\\.com/foo/bar@v1\\.2\\.3:\\ parsing\\ go\\.mod:\\\n\\\tmodule\\ declares\\ its\\ path\\ as:\\ github\\.com/foo/baz\\\n\\\t\\ \\ \\ \\ \\ \\ \\ \\ but\\ was\\ required\\ as:\\ github\\.com/foo/bar",
  "domain": "go",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "The module's go.mod declares a different module path than the import path used. Common after a repo rename/fork without updating go.mod.",
  "root_cause_type": "generic",
  "root_cause_zh": "模块的 go.mod 声明的模块路径与使用的导入路径不同。常见于仓库重命名/派生后未更新 go.mod。",
  "versions": [
    {
      "version": "1.16+",
      "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"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "go.sum does not encode module path mapping; the error persists",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "GOPRIVATE only affects proxy/checksum behavior, not path validation",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "the source at that path may not exist or may be a different module",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "go mod edit -replace=github.com/foo/bar=github.com/foo/baz@v1.2.3\ngo mod tidy",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "// in your fork's go.mod\nmodule github.com/you/bar\n// then: go mod edit -replace=github.com/foo/bar=github.com/you/bar@v0.0.0-<pseudo>",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-14",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}