{
  "id": "terraform/terraform-state-version-mismatch",
  "signature": "Error: State data in S3 does not have the expected content: unexpected end of JSON input",
  "signature_zh": "错误：S3 中的状态数据没有预期内容：意外的 JSON 输入结束",
  "regex": "State data in S3 does not have the expected content: unexpected end of JSON input",
  "domain": "terraform",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "The state file in the backend is empty, corrupted, or truncated, often due to concurrent writes or incomplete uploads.",
  "root_cause_type": "generic",
  "root_cause_zh": "后端中的状态文件为空、损坏或被截断，通常由并发写入或不完整上传引起。",
  "versions": [
    {
      "version": "Terraform v1.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Terraform v1.6",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Terraform v1.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Terraform v1.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Reinitialization does not fix a corrupted state file; it only reconfigures the backend connection.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Deleting the state file without a backup leads to complete loss of state, requiring manual re-import of all resources, which is error-prone.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "'terraform state pull' only downloads the state as-is; it does not repair corrupted data.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Restore the state file from a previous backup version in S3 (if versioning is enabled) using AWS CLI: 'aws s3api get-object-version --bucket <bucket> --key <key> --version-id <version-id> terraform.tfstate.backup'.",
      "success_rate": 0.85,
      "how": "Restore the state file from a previous backup version in S3 (if versioning is enabled) using AWS CLI: 'aws s3api get-object-version --bucket <bucket> --key <key> --version-id <version-id> terraform.tfstate.backup'.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If no backup exists, use 'terraform state pull' to download the current state, manually fix the JSON if possible, then push it back using 'terraform state push fixed.tfstate'.",
      "success_rate": 0.5,
      "how": "If no backup exists, use 'terraform state pull' to download the current state, manually fix the JSON if possible, then push it back using 'terraform state push fixed.tfstate'.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Restore the state file from a previous backup version in S3 (if versioning is enabled) using AWS CLI: 'aws s3api get-object-version --bucket <bucket> --key <key> --version-id <version-id> terraform.tfstate.backup'.",
    "If no backup exists, use 'terraform state pull' to download the current state, manually fix the JSON if possible, then push it back using 'terraform state push fixed.tfstate'."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://developer.hashicorp.com/terraform/language/state/backends#s3",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.8,
  "fix_success_rate": 0.7,
  "resolvable": "true",
  "first_seen": "2024-03-01",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}