{"record":{"id":"00e42de86a5ef8a3","repo":"hashicorp/terraform","slug":"failed-to-commit-multipart-upload-s","errorCode":null,"errorMessage":"failed to commit multipart upload: %s","messagePattern":"failed to commit multipart upload: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote-state/oci/multipart_upload.go","lineNumber":163,"sourceCode":"\t\t\tlogger.Error(fmt.Sprintf(\"Failed to abort multipart upload: %s\", abortErr))\n\t\t}\n\t\treturn fmt.Errorf(\"not all parts uploaded successfully, multipart upload aborted\")\n\t}\n\n\tcommitMultipartUploadRequest := objectstorage.CommitMultipartUploadRequest{\n\t\tUploadId:           multipartUploadResponse.MultipartUpload.UploadId,\n\t\tNamespaceName:      multipartUploadResponse.Namespace,\n\t\tBucketName:         multipartUploadResponse.Bucket,\n\t\tObjectName:         multipartUploadResponse.Object,\n\t\tOpcClientRequestId: multipartUploadResponse.OpcClientRequestId,\n\t\tRequestMetadata:    multipartUploadRequest.RequestMetadata,\n\t\tCommitMultipartUploadDetails: objectstorage.CommitMultipartUploadDetails{\n\t\t\tPartsToCommit: commitMultipartUploadPartDetails,\n\t\t},\n\t}\n\t_, err = multipartUploadData.client.objectStorageClient.CommitMultipartUpload(context.Background(), commitMultipartUploadRequest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to commit multipart upload: %s\", err)\n\t}\n\n\treturn nil\n}\nfunc (m MultipartUploadData) objectMultiPartSplit() ([]objectStorageSourceBlock, error) {\n\tdataSize := int64(len(m.Data))\n\toffsets, partSize, err := SplitSizeToOffsetsAndLimits(dataSize)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error splitting data into parts: %s\", err)\n\t}\n\tsourceBlocks := make([]objectStorageSourceBlock, len(offsets))\n\tfor i := range offsets {\n\t\tstart := offsets[i]\n\t\tend := start + partSize\n\t\tif end > dataSize {\n\t\t\tend = dataSize\n\t\t}\n\t\tsourceBlocks[i] = objectStorageSourceBlock{","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/remote-state/oci/multipart_upload.go#L145-L181","documentation":"Raised in multiPartUploadImpl when the final CommitMultipartUpload API call fails. All parts uploaded, but the commit that assembles them into the final object was rejected by OCI. The wrap surfaces the raw SDK error (parts list mismatch, auth, throttling, the upload session expired, or a service fault).","triggerScenarios":"objectStorageClient.CommitMultipartUpload (multipart_upload.go:161) returns a non-nil error: 400/InvalidParameter when PartsToCommit etag/part numbers do not match what the service recorded, 404 when the upload-id expired or was aborted elsewhere, 401/403, 429, or 5xx/network.","commonSituations":"Upload session took too long and OCI reaped the multipart upload; a part was retried server-side changing its etag so the commit list is stale; IAM permission revoked mid-run; throttling at commit; transient service fault.","solutions":["Read the wrapped ErrorCode: 404/expired -> the multipart session is gone, re-run the whole upload; InvalidParameter -> a part etag/part-number is stale.","Re-run the apply; commit failures are usually transient or resolved by a fresh upload session.","Ensure the upload completes within OCI's multipart-upload retention window (avoid long stalls between parts).","For throttling, reduce parallel writers and rely on retry policy; sustained issues need a service-limit increase."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pre-flight: ensure the upload session will commit promptly (no long stalls):\n// keep total upload time under OCI's multipart-upload retention window.","typeGuard":"var se common.ServiceError\nif errors.As(err, &se) {\n    switch se.GetHTTPStatusCode() {\n    case 404: // upload-id expired/aborted -> full re-run\n    case 400: // stale etag/part list\n    case 429: // throttled\n    }\n}","tryCatchPattern":"_, err = c.objectStorageClient.CommitMultipartUpload(ctx, commitReq)\nif err != nil {\n    return fmt.Errorf(\"failed to commit multipart upload: %s\", err)\n}","preventionTips":["Complete the upload within OCI's multipart retention window.","Keep IAM permissions valid for the whole run.","Retry transient commit failures; a fresh session usually succeeds."],"tags":["oci","multipart-upload","commit","auth","throttling","terraform-state"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}