{"record":{"id":"c3ad5fbbb2030af6","repo":"hashicorp/terraform","slug":"estimating-object-s-is-exist-got-an-error-v","errorCode":null,"errorMessage":"estimating object %s is exist got an error: %#v","messagePattern":"estimating object (.+?) is exist got an error: %#v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote-state/oss/client.go","lineNumber":420,"sourceCode":"\t\tlockErr.Err = err\n\t\treturn lockErr\n\t}\n\n\treturn nil\n}\n\nfunc (c *RemoteClient) lockPath() string {\n\treturn fmt.Sprintf(\"%s/%s\", c.bucketName, c.stateFile)\n}\n\nfunc (c *RemoteClient) getObj() (*remote.Payload, error) {\n\tbucket, err := c.ossClient.Bucket(c.bucketName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting bucket %s: %#v\", c.bucketName, err)\n\t}\n\n\tif exist, err := bucket.IsObjectExist(c.stateFile); err != nil {\n\t\treturn nil, fmt.Errorf(\"estimating object %s is exist got an error: %#v\", c.stateFile, err)\n\t} else if !exist {\n\t\treturn nil, nil\n\t}\n\n\tvar options []oss.Option\n\toutput, err := bucket.GetObject(c.stateFile, options...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting object: %#v\", err)\n\t}\n\n\tbuf := bytes.NewBuffer(nil)\n\tif _, err := io.Copy(buf, output); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read remote state: %s\", err)\n\t}\n\tsum := md5.Sum(buf.Bytes())\n\tpayload := &remote.Payload{\n\t\tData: buf.Bytes(),\n\t\tMD5:  sum[:],","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/remote-state/oss/client.go#L402-L438","documentation":"In RemoteClient.getObj() (client.go:419-420), bucket.IsObjectExist(stateFile) failed. IsObjectExist does a HeadObject under the hood; a real OSS service/permission/network error surfaces here (a clean 'does not exist' returns false, not an error). %#v dumps the OSS SDK error.","triggerScenarios":"HeadObject returns an error other than 404: AccessDenied (oss:GetObject/Meta), network/timeout, transient 5xx, or signature mismatch. A genuine 'object absent' is handled by the else-if at line 421 returning nil payload, so this error is always an infrastructure/permission fault.","commonSituations":"RAM policy lacks oss:GetObject or head-style meta permission on the prefix; bucket deleted; OSS regional issue; proxy blocking HEAD requests; clock skew causing SignatureDoesNotMatch on the HEAD.","solutions":["Grant oss:GetObject (and meta read) on arn:acs:oss:*:*:<bucket>/<prefix>/*.","Confirm the bucket exists and is in the configured region.","Fix host clock skew if %#v shows SignatureDoesNotMatch.","Retry after confirming OSS endpoint reachability/proxy egress."],"exampleFix":"// before: policy missing GetObject\n//   Action: \"oss:PutObject\" only\n// after:\n//   Action: [\"oss:GetObject\", \"oss:PutObject\", \"oss:DeleteObject\"]\n//   Resource: \"acs:oss:*:*:tf-state/tf-state-prefix/*\"","handlingStrategy":"retry","validationCode":"// Pre-check object existence yourself with explicit error handling before terraform refresh.\nfunc stateReadable(bucket *oss.Bucket, key string) error {\n    exist, err := bucket.IsObjectExist(key)\n    if err != nil {\n        return fmt.Errorf(\"cannot stat %s: %w\", key, err)\n    }\n    if !exist { return nil } // first-run, no state yet\n    return nil\n}","typeGuard":null,"tryCatchPattern":"// Retry on transient HEAD errors; fail fast on AccessDenied/SignatureDoesNotMatch.\nif oe, ok := err.(oss.ServiceError); ok {\n    if oe.StatusCode >= 500 || oe.StatusCode == 408 { return retry() }\n    if oe.StatusCode == 403 { return grantGetObjectPolicy() }\n}","preventionTips":["Grant oss:GetObject on the state prefix.","Keep host clocks synced (NTP) to avoid SignatureDoesNotMatch on HEAD.","Ensure proxy/firewall allows HEAD to the OSS endpoint."],"tags":["alibaba-cloud","oss","remote-state","object-existence","permissions","go"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}