{
  "id": "terraform/invalid-index-in-output",
  "signature": "Error: Invalid index: output value is a list but no index was specified",
  "signature_zh": "错误：无效索引：输出值为列表但未指定索引",
  "regex": "Error: Invalid index: output value is a list but no index was specified",
  "domain": "terraform",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "A module output that returns a list is referenced without an index, causing a type mismatch when Terraform expects a single value.",
  "root_cause_type": "generic",
  "root_cause_zh": "模块输出返回列表，但在引用时未指定索引，导致 Terraform 期望单个值时类型不匹配。",
  "versions": [
    {
      "version": "Terraform >=1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "AWS Provider 5.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Outputs do not support count; this fix leads to a syntax error.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Alters the module's contract and may cause downstream errors.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Reference the output with an explicit index, e.g., `module.my_module.output_name[0]` or use `element(module.my_module.output_name, 0)`.",
      "success_rate": 0.9,
      "how": "Reference the output with an explicit index, e.g., `module.my_module.output_name[0]` or use `element(module.my_module.output_name, 0)`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If you need all values, use `module.my_module.output_name[*]` to preserve the list type.",
      "success_rate": 0.85,
      "how": "If you need all values, use `module.my_module.output_name[*]` to preserve the list type.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "使用显式索引引用输出，例如 `module.my_module.output_name[0]` 或使用 `element(module.my_module.output_name, 0)`。",
    "如果需要所有值，使用 `module.my_module.output_name[*]` 以保留列表类型。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://developer.hashicorp.com/terraform/language/expressions/references#outputs",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2023-09-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}