{
  "id": "terraform/terraform-init-module-source-error",
  "signature": "Error: Failed to download module: could not download module: source not found",
  "signature_zh": "错误：下载模块失败：无法下载模块：源未找到",
  "regex": "Failed to download module: could not download module: source not found",
  "domain": "terraform",
  "category": "install_error",
  "subcategory": null,
  "root_cause": "The module source URL or path specified in the configuration is incorrect, unreachable, or requires authentication.",
  "root_cause_type": "generic",
  "root_cause_zh": "配置中指定的模块源 URL 或路径不正确、无法访问或需要身份验证。",
  "versions": [
    {
      "version": "1.5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.7.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Run terraform init -upgrade without checking the source URL.",
      "why_fails": "If the source URL is wrong, upgrading won't fix it; it will just try the same wrong URL again.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Set GIT_TERMINAL_PROMPT=1 and hope for an interactive prompt.",
      "why_fails": "This only helps if the source is a private Git repo and you need to enter credentials, but the error says 'source not found', not authentication failure.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Delete the .terraform directory and run terraform init again.",
      "why_fails": "This only clears the local cache; it doesn't fix the invalid source reference.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Verify the module source in the configuration. For example, if using a Git repo, ensure the URL is correct: module \"vpc\" { source = \"git::https://github.com/org/terraform-aws-vpc.git?ref=v1.0.0\" }. Test the URL in a browser or with git clone.",
      "success_rate": 0.9,
      "how": "Verify the module source in the configuration. For example, if using a Git repo, ensure the URL is correct: module \"vpc\" { source = \"git::https://github.com/org/terraform-aws-vpc.git?ref=v1.0.0\" }. Test the URL in a browser or with git clone.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the module is from the Terraform Registry, ensure the source is in the format \"namespace/name/provider\". Run terraform init -from-module=namespace/name/provider to test.",
      "success_rate": 0.85,
      "how": "If the module is from the Terraform Registry, ensure the source is in the format \"namespace/name/provider\". Run terraform init -from-module=namespace/name/provider to test.",
      "condition": "",
      "sources": []
    },
    {
      "action": "For local modules, ensure the path is relative to the root module and exists. Use an absolute path for testing: source = \"/home/user/modules/my-module\".",
      "success_rate": 0.8,
      "how": "For local modules, ensure the path is relative to the root module and exists. Use an absolute path for testing: source = \"/home/user/modules/my-module\".",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "验证配置中的模块源。例如，如果使用 Git 仓库，请确保 URL 正确：module \"vpc\" { source = \"git::https://github.com/org/terraform-aws-vpc.git?ref=v1.0.0\" }。在浏览器中或使用 git clone 测试 URL。",
    "如果模块来自 Terraform Registry，请确保源格式为 \"namespace/name/provider\"。运行 terraform init -from-module=namespace/name/provider 进行测试。",
    "对于本地模块，请确保路径相对于根模块且存在。使用绝对路径进行测试：source = \"/home/user/modules/my-module\"。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://developer.hashicorp.com/terraform/language/modules/sources",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.87,
  "resolvable": "true",
  "first_seen": "2023-08-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}