hashicorp/terraform · error

error creating multipart upload: %s

Error message

error creating multipart upload: %s

What it means

Raised in multiPartUploadImpl when the OCI CreateMultipartUpload API call fails. Until this succeeds no upload-id exists, so no parts can be uploaded. The wrap surfaces the raw SDK error (auth, authorization, bucket/object config, KMS, SSE-C, throttling, network).

Source

Thrown at internal/backend/remote-state/oci/multipart_upload.go:79

	multipartUploadRequest := &objectstorage.CreateMultipartUploadRequest{
		NamespaceName:   common.String(multipartUploadData.client.namespace),
		BucketName:      common.String(multipartUploadData.client.bucketName),
		RequestMetadata: multipartUploadData.RequestMetadata,
		CreateMultipartUploadDetails: objectstorage.CreateMultipartUploadDetails{
			Object: common.String(multipartUploadData.client.path),
		},
	}
	if multipartUploadData.client.kmsKeyID != "" {
		multipartUploadRequest.OpcSseKmsKeyId = common.String(multipartUploadData.client.kmsKeyID)
	} else if multipartUploadData.client.SSECustomerKey != "" && multipartUploadData.client.SSECustomerKeySHA256 != "" {
		multipartUploadRequest.OpcSseCustomerKey = common.String(multipartUploadData.client.SSECustomerKey)
		multipartUploadRequest.OpcSseCustomerKeySha256 = common.String(multipartUploadData.client.SSECustomerKeySHA256)
		multipartUploadRequest.OpcSseCustomerAlgorithm = common.String(multipartUploadData.client.SSECustomerAlgorithm)
	}

	multipartUploadResponse, err := multipartUploadData.client.objectStorageClient.CreateMultipartUpload(context.Background(), *multipartUploadRequest)
	if err != nil {
		return fmt.Errorf("error creating multipart upload: %s", err)
	}

	workerCount := defaultNumberOfGoroutines
	osUploadPartResponses := make(chan objectStorageUploadPartResponse, len(sourceBlocks))
	sourceBlocksChan := make(chan objectStorageSourceBlock, len(sourceBlocks))

	wg := &sync.WaitGroup{}
	wg.Add(len(sourceBlocks))

	// Push all source blocks into the channel
	for _, sourceBlock := range sourceBlocks {
		sourceBlocksChan <- sourceBlock
	}
	close(sourceBlocksChan)
	errChan := make(chan error, workerCount)
	// Start workers
	for i := 0; i < workerCount; i++ {
		go func() {

View on GitHub (pinned to c9def3e214)

Solutions

  1. Read the wrapped OCI ErrorCode: 403 -> grant OBJECT_CREATE; InvalidParameter -> fix kms_key_id/SSE-C fields.
  2. Verify the KMS key OCID is valid in-region and the principal has KEY_USE on it.
  3. Confirm bucket and namespace exist and the object key is valid.
  4. Re-run; the create call is covered by getDefaultRetryPolicy for transient 429/5xx.
  5. Note: when this fails the caller (client.Put) falls back to single-part upload if dataSize <= MaxFilePartSize, so a true failure here that also fails single-part points to auth/config.
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight config checks:
if c.kmsKeyID != "" && !strings.HasPrefix(c.kmsKeyID, "ocid1.key.") {
    return fmt.Errorf("invalid kms_key_id")
}
if c.bucketName == "" || c.namespace == "" { return fmt.Errorf("bucket/namespace required") }

Type guard

var se common.ServiceError
if errors.As(err, &se) {
    switch se.GetHTTPStatusCode() {
    case 403: // OBJECT_CREATE missing
    case 400: // bad KMS/SSE-C params
    case 404: // bucket/namespace missing
    case 429: // throttled
    }
}

Try / catch

multipartUploadResponse, err := c.objectStorageClient.CreateMultipartUpload(ctx, *req)
if err != nil {
    return fmt.Errorf("error creating multipart upload: %s", err)
}

Prevention

When it happens

Trigger: objectStorageClient.CreateMultipartUpload (multipart_upload.go:77) returns a non-nil error: 401/403 lacking permission, 400 for a bad OpcSseKmsKeyId / SSE-Customer fields, 404 bucket/namespace, 429, or 5xx/network.

Common situations: IAM principal lacks OBJECT_CREATE; KMS key id invalid or in wrong region; SSE-Customer key fields inconsistent; wrong namespace/bucket; throttling at upload start; network blip initiating the multipart session.

Related errors


AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07). Data as JSON: /api/errors/d5594074e84876cc. Report an issue: GitHub.