{"record":{"id":"916e8db0ddf16916","repo":"hashicorp/terraform","slug":"error-splitting-source-data-s","errorCode":null,"errorMessage":"error splitting source data: %s","messagePattern":"error splitting source data: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote-state/oci/multipart_upload.go","lineNumber":58,"sourceCode":"\tsourceBlocks            chan objectStorageSourceBlock\n\tosUploadPartResponses   chan objectStorageUploadPartResponse\n\twg                      *sync.WaitGroup\n\terrChan                 chan error\n\tmultipartUploadResponse objectstorage.CreateMultipartUploadResponse\n\tmultipartUploadRequest  objectstorage.CreateMultipartUploadRequest\n\tlogger                  hclog.Logger\n}\n\ntype objectStorageSourceBlock struct {\n\tsection     *io.SectionReader\n\tblockNumber *int\n}\n\nfunc (multipartUploadData MultipartUploadData) multiPartUploadImpl(ctx context.Context) error {\n\tlogger := ctx.Value(\"logger\").(hclog.Logger).Named(\"multiPartUpload\")\n\tsourceBlocks, err := multipartUploadData.objectMultiPartSplit()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error splitting source data: %s\", err)\n\t}\n\n\tmultipartUploadRequest := &objectstorage.CreateMultipartUploadRequest{\n\t\tNamespaceName:   common.String(multipartUploadData.client.namespace),\n\t\tBucketName:      common.String(multipartUploadData.client.bucketName),\n\t\tRequestMetadata: multipartUploadData.RequestMetadata,\n\t\tCreateMultipartUploadDetails: objectstorage.CreateMultipartUploadDetails{\n\t\t\tObject: common.String(multipartUploadData.client.path),\n\t\t},\n\t}\n\tif multipartUploadData.client.kmsKeyID != \"\" {\n\t\tmultipartUploadRequest.OpcSseKmsKeyId = common.String(multipartUploadData.client.kmsKeyID)\n\t} else if multipartUploadData.client.SSECustomerKey != \"\" && multipartUploadData.client.SSECustomerKeySHA256 != \"\" {\n\t\tmultipartUploadRequest.OpcSseCustomerKey = common.String(multipartUploadData.client.SSECustomerKey)\n\t\tmultipartUploadRequest.OpcSseCustomerKeySha256 = common.String(multipartUploadData.client.SSECustomerKeySHA256)\n\t\tmultipartUploadRequest.OpcSseCustomerAlgorithm = common.String(multipartUploadData.client.SSECustomerAlgorithm)\n\t}\n","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/backend/remote-state/oci/multipart_upload.go#L40-L76","documentation":"objectMultiPartSplit failed, almost always because SplitSizeToOffsetsAndLimits returned 'file exceeds maximum part count' — the state byte size implies more than MaxCount (10000) parts at DefaultFilePartSize (128 MiB), i.e. a state file larger than ~1.28 TiB. This is reached only when dataSize > DefaultFilePartSize so multipart is chosen.","triggerScenarios":"State byte size exceeds MaxCount * DefaultFilePartSize; DefaultFilePartSize was lowered globally without recomputing the limit; an enormous state from a monolithic root module.","commonSituations":"A single root module tracking tens of thousands of resources; tuning DefaultFilePartSize down for memory reasons; importing a huge dataset into state.","solutions":["Reduce state size: split the root module into workspaces/modules so each state file is smaller.","Raise DefaultFilePartSize so fewer parts are needed (must stay within OCI's per-part max and ≤ MaxFilePartSize 50 GiB; keep partSize*MaxCount above your state size).","Prune stale/deleted resources from state with `terraform state rm` / `state pull` + manual cleanup.","If hit during a one-off import, split the import into smaller batches."],"exampleFix":"// before: state of 1.4 TiB with DefaultFilePartSize = 128 MiB\n//   totalParts = ceil(1.4 TiB / 128 MiB) = 11200 > MaxCount(10000) -> 315\n// after: raise part size so parts fit under MaxCount\nvar DefaultFilePartSize int64 = 256 * 1024 * 1024 // 256 MiB -> 5600 parts\n// and split the root module across workspaces to keep state bounded","handlingStrategy":"validation","validationCode":"// Validate state size against the multipart limits before uploading\nfunc validateStateForMultipart(size int64) error {\n    parts := (size + DefaultFilePartSize - 1) / DefaultFilePartSize\n    if parts > MaxCount {\n        return fmt.Errorf(\"state (%d bytes) needs %d parts > MaxCount %d; split the workspace or raise DefaultFilePartSize\",\n            size, parts, MaxCount)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep state files small by splitting large root modules into workspaces/modules.","When tuning DefaultFilePartSize down, recompute partSize*MaxCount against your largest state.","Prune deleted resources from state periodically.","Alert on state size growth so you act before hitting the limit."],"tags":["oci","multipart-upload","state-size","configuration"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}