{
  "id": "terraform/invalid-terraform-version-constraint-syntax",
  "signature": "Error: Invalid terraform version constraint: version constraint \"~> 1.0, >= 1.2\" contains invalid operators or syntax",
  "signature_zh": "错误：无效的 Terraform 版本约束：版本约束 \"~> 1.0, >= 1.2\" 包含无效的操作符或语法",
  "regex": "Invalid terraform version constraint: version constraint \".*\" contains invalid operators or syntax",
  "domain": "terraform",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The version constraint string in the required_version block has a syntax error, such as mixing incompatible operators or using unsupported characters.",
  "root_cause_type": "generic",
  "root_cause_zh": "required_version 块中的版本约束字符串存在语法错误，例如混合不兼容的操作符或使用不支持的字符。",
  "versions": [
    {
      "version": "Terraform v1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Terraform v1.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Terraform v1.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding a comma between constraints without checking operator compatibility (e.g., `~> 1.0, >= 1.2`)",
      "why_fails": "The comma is allowed but the combination of `~> 1.0` (pessimistic) and `>= 1.2` can conflict; Terraform may reject ambiguous combinations.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using a single equals sign (e.g., `= 1.0`) instead of `~>` or `>=`",
      "why_fails": "Single equals is valid but too restrictive; it doesn't cause the syntax error but may fail to match expected versions, leading to a different error.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    },
    {
      "action": "Removing all quotes around the version constraint string",
      "why_fails": "Quotes are required for string values in HCL; removing them causes a parse error before version validation.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use a single valid constraint: `terraform { required_version = \">= 1.2\" }` or `required_version = \"~> 1.2\"` without combining multiple operators.",
      "success_rate": 0.95,
      "how": "Use a single valid constraint: `terraform { required_version = \">= 1.2\" }` or `required_version = \"~> 1.2\"` without combining multiple operators.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If combining constraints, use only compatible operators: `terraform { required_version = \">= 1.2, < 2.0\" }` (both range operators) instead of mixing `~>` and `>=`.",
      "success_rate": 0.85,
      "how": "If combining constraints, use only compatible operators: `terraform { required_version = \">= 1.2, < 2.0\" }` (both range operators) instead of mixing `~>` and `>=`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Validate the constraint syntax using `terraform version` command or an online HCL validator before applying.",
      "success_rate": 0.9,
      "how": "Validate the constraint syntax using `terraform version` command or an online HCL validator before applying.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Use a single valid constraint: `terraform { required_version = \">= 1.2\" }` or `required_version = \"~> 1.2\"` without combining multiple operators.",
    "If combining constraints, use only compatible operators: `terraform { required_version = \">= 1.2, < 2.0\" }` (both range operators) instead of mixing `~>` and `>=`.",
    "Validate the constraint syntax using `terraform version` command or an online HCL validator before applying."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://developer.hashicorp.com/terraform/language/settings#specifying-a-required-terraform-version",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-04-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}