{"record":{"id":"e57086fa2d80bb46","repo":"hashicorp/terraform","slug":"state-data-in-oss-does-not-have-the-expected-conte","errorCode":null,"errorMessage":"state data in OSS does not have the expected content.\n\nThis may be caused by unusually long delays in OSS processing a previous state\nupdate.  Please wait for a minute or two and try again. If this problem\npersists, and neither OSS nor Tablestore are experiencing an outage, you may need\nto manually verify the remote state and update the Digest value stored in the\nTableStore table to the following value: %x","messagePattern":"state data in OSS does not have the expected content\\.\n\nThis may be caused by unusually long delays in OSS processing a previous state\nupdate\\.  Please wait for a minute or two and try again\\. If this problem\npersists, and neither OSS nor Tablestore are experiencing an outage, you may need\nto manually verify the remote state and update the Digest value stored in the\nTableStore table to the following value: %x","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote-state/oss/client.go","lineNumber":92,"sourceCode":"\t\t}\n\n\t\t// verify that this state is what we expect\n\t\tif expected, err := c.getMD5(); err != nil {\n\t\t\tlog.Printf(\"[WARN] failed to fetch state md5: %s\", err)\n\t\t} else if len(expected) > 0 && !bytes.Equal(expected, digest) {\n\t\t\tlog.Printf(\"[WARN] state md5 mismatch: expected '%x', got '%x'\", expected, digest)\n\n\t\t\tif testChecksumHook != nil {\n\t\t\t\ttestChecksumHook()\n\t\t\t}\n\n\t\t\tif time.Now().Before(deadline) {\n\t\t\t\ttime.Sleep(consistencyRetryPollInterval)\n\t\t\t\tlog.Println(\"[INFO] retrying OSS RemoteClient.Get...\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\treturn nil, diags.Append(fmt.Errorf(errBadChecksumFmt, digest))\n\t\t}\n\n\t\tbreak\n\t}\n\treturn payload, diags\n}\n\nfunc (c *RemoteClient) Put(data []byte) tfdiags.Diagnostics {\n\tvar diags tfdiags.Diagnostics\n\tbucket, err := c.ossClient.Bucket(c.bucketName)\n\tif err != nil {\n\t\treturn diags.Append(fmt.Errorf(\"error getting bucket: %#v\", err))\n\t}\n\n\tbody := bytes.NewReader(data)\n\n\tvar options []oss.Option\n\tif c.acl != \"\" {","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/backend/remote-state/oss/client.go#L74-L110","documentation":"Thrown by RemoteClient.Get after retrying: the MD5 digest stored in Tablestore does not match the MD5 of the OSS state object retrieved, and the retry deadline expired. OSS eventual consistency caused a stale object read; the backend refuses to return state whose integrity cannot be verified.","triggerScenarios":"A prior Put wrote a new state and its MD5 to Tablestore, but a subsequent Get read a stale OSS object (pre-update) whose MD5 differs from the stored digest. After consistencyRetryPollInterval retries until the deadline, the mismatch persists.","commonSituations":"OSS eventual-consistency lag, especially cross-region or right after a fast double-apply; a previous write was partial; an out-of-band tool modified the OSS object without updating Tablestore.","solutions":["Wait 1–2 minutes for OSS consistency to settle, then retry terraform plan/apply.","If persistent, manually compute the current OSS object MD5 and update the Digest value in the Tablestore lock row to match the format shown (%x).","Verify no external process is overwriting the OSS state object outside terraform.","Confirm OSS and Tablestore are not in separate regions/endpoint configurations that increase replication lag."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// On MD5 mismatch, retry with backoff up to the consistency window; only then surface the digest.\nfor attempt := 0; attempt < maxAttempts; attempt++ {\n    payload, err := get()\n    if err == nil || !isBadChecksum(err) { return payload, err }\n    time.Sleep(consistencyRetryPollInterval)\n}\nreturn nil, fmt.Errorf(errBadChecksumFmt, digest)","preventionTips":["Avoid back-to-back applies that rely on immediate cross-object consistency.","Keep OSS bucket and Tablestore table in the same region.","Prevent out-of-band writes to the OSS state object that bypass the MD5 update."],"tags":["alibaba-cloud","oss","tablestore","md5","eventual-consistency","remote-state","integrity"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}