{"record":{"id":"92cb03a65270a42b","repo":"hashicorp/terraform","slug":"failed-to-negotiate-acceptable-chunk-size-expecte","errorCode":null,"errorMessage":"Failed to negotiate acceptable chunk size. Expected size > 0 and <= %d bytes, provider wants %d bytes","messagePattern":"Failed to negotiate acceptable chunk size\\. Expected size > 0 and <= (.+?) bytes, provider wants (.+?) bytes","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/pluggable/pluggable.go","lineNumber":129,"sourceCode":"\tvar diags tfdiags.Diagnostics\n\treq := providers.ConfigureStateStoreRequest{\n\t\tTypeName: p.typeName,\n\t\tConfig:   config,\n\t\tCapabilities: providers.StateStoreClientCapabilities{\n\t\t\t// The core binary will always request the default chunk size from the provider to start\n\t\t\tChunkSize: chunks.DefaultStateStoreChunkSize,\n\t\t},\n\t}\n\tresp := p.provider.ConfigureStateStore(req)\n\tdiags = diags.Append(resp.Diagnostics)\n\tif diags.HasErrors() {\n\t\treturn diags\n\t}\n\n\t// Validate the returned value from chunk size negotiation\n\tchunkSize := resp.Capabilities.ChunkSize\n\tif chunkSize == 0 || chunkSize > chunks.MaxStateStoreChunkSize {\n\t\tdiags = diags.Append(fmt.Errorf(\"Failed to negotiate acceptable chunk size. \"+\n\t\t\t\"Expected size > 0 and <= %d bytes, provider wants %d bytes\",\n\t\t\tchunks.MaxStateStoreChunkSize, chunkSize,\n\t\t))\n\t\treturn diags\n\t}\n\n\t// Negotiated chunk size is valid, so set it in the provider server\n\t// that will use the value for future RPCs to read/write state.\n\tcs := p.provider.(providers.StateStoreChunkSizeSetter)\n\tcs.SetStateStoreChunkSize(p.typeName, int(chunkSize))\n\tlog.Printf(\"[TRACE] Pluggable.Configure: negotiated a chunk size of %v when configuring state store %s\",\n\t\tchunkSize,\n\t\tp.typeName,\n\t)\n\n\treturn resp.Diagnostics\n}\n","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/pluggable/pluggable.go#L111-L147","documentation":"Returned by Pluggable.Configure when negotiating the chunk size for state transfers with a custom state-store provider. After ConfigureStateStore returns, Terraform validates the provider's reported ChunkSize: it must be > 0 and <= chunks.MaxStateStoreChunkSize. A zero or oversized value means the provider is non-compliant or buggy.","triggerScenarios":"Configuring a pluggable state store (a provider implementing the StateStore interface) whose ConfigureStateStore response returns ChunkSize == 0 (unset/default) or a value exceeding the negotiated maximum. Happens at terraform init/Configure time for that backend.","commonSituations":"Using a custom/alpha state-store provider that doesn't set ChunkSize; a provider bug returning an uninitialized value; version mismatch where the provider targets an older contract with different size semantics.","solutions":["Update/upgrade the state-store provider to a version that correctly returns a chunk size within the allowed range.","Report the bug to the provider author — the provider's ConfigureStateStore must populate ChunkSize in its Capabilities response.","Fall back to a built-in backend (s3/azurerm/gcs/etc.) until the provider is fixed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate provider chunk size contract before relying on it.\nif resp.Capabilities.ChunkSize == 0 || resp.Capabilities.ChunkSize > chunks.MaxStateStoreChunkSize {\n    return errors.New(\"provider returned invalid chunk size\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin to a tested, released state-store provider version that respects the chunk-size contract.","In integration tests for custom providers, assert ConfigureStateStore returns a valid ChunkSize.","Fall back to a built-in backend for production state until a custom provider is mature."],"tags":["provider","pluggable","state-store","negotiation","terraform"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}