{"record":{"id":"dd09e404a56431e4","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/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/remote-state/oss/client.go#L74-L110","documentation":"The errBadChecksumFmt const (client.go:449) returned by RemoteClient.Get() (client.go:92) after the digest retry loop exhausts consistencyRetryTimeout (10s). It means the OSS object's MD5 still does not equal the Digest value stored in TableStore. OSS writes and OTS writes are separate, so eventual consistency or an interrupted Put can leave them divergent, and Get() detects this corruption.","triggerScenarios":"Get() computes payload.MD5 from the OSS object, reads expected from getMD5() (OTS Digest row), and on mismatch retries every consistencyRetryPollInterval (2s) until the 10s deadline; if still mismatched, line 92 returns this error with the actual MD5 hex so the user can repair the OTS row.","commonSituations":"A previous Put() wrote OSS but failed before putMD5 completed (or vice-versa); OSS region experienced replication/read-after-write delay; manual edits to the state object; OTS Digest row edited by another tool; testChecksumHook triggered in tests.","solutions":["Wait 1-2 minutes for OSS eventual consistency and re-run terraform (the built-in 10s retry may be too short).","If persistent, manually verify the OSS object then update the TableStore Digest row to the %x value printed in the error.","Check for a crashed prior apply that left OSS/OTS out of sync and reconcile the digest.","Confirm neither OSS nor TableStore is in a regional outage."],"exampleFix":"// the error prints the expected MD5, e.g. a1b2c3...\n// repair the OTS Digest row to that value:\n// in TableStore console, edit row LockID=<bucket>/<stateFile>-md5,\n// set column Digest = \"a1b2c3...\" (the hex from the message)","handlingStrategy":"retry","validationCode":"// Pre-flight: compare the OSS object MD5 with the OTS Digest row yourself, and\n// if mismatched, either wait or repair before invoking terraform Get.\nfunc digestConsistent(ossMD5, otsDigest []byte) bool {\n    return bytes.Equal(ossMD5, otsDigest)\n}","typeGuard":null,"tryCatchPattern":"// The backend already retries for 10s. For longer flaps, back off and retry\n// at the caller; if still broken, repair the OTS Digest row to the printed %x.\nfor attempt := 0; attempt < 5; attempt++ {\n    _, diags := client.Get()\n    if !diags.HasErrors() { break }\n    time.Sleep(30 * time.Second)\n}","preventionTips":["Avoid interrupting terraform apply mid-write; a crash between OSS PutObject and OTS PutRow causes this.","Monitor OSS and OTS regional status before large applies.","Keep the OTS Digest row under terraform's control only; do not edit it externally."],"tags":["alibaba-cloud","oss","tablestore","remote-state","consistency","md5","go"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}