hashicorp/terraform · error
Failed to negotiate acceptable chunk size. Expected size > 0
Error message
Failed to negotiate acceptable chunk size. Expected size > 0 and <= %d bytes, provider wants %d bytes
What it means
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.
Source
Thrown at internal/backend/pluggable/pluggable.go:129
var diags tfdiags.Diagnostics
req := providers.ConfigureStateStoreRequest{
TypeName: p.typeName,
Config: config,
Capabilities: providers.StateStoreClientCapabilities{
// The core binary will always request the default chunk size from the provider to start
ChunkSize: chunks.DefaultStateStoreChunkSize,
},
}
resp := p.provider.ConfigureStateStore(req)
diags = diags.Append(resp.Diagnostics)
if diags.HasErrors() {
return diags
}
// Validate the returned value from chunk size negotiation
chunkSize := resp.Capabilities.ChunkSize
if chunkSize == 0 || chunkSize > chunks.MaxStateStoreChunkSize {
diags = diags.Append(fmt.Errorf("Failed to negotiate acceptable chunk size. "+
"Expected size > 0 and <= %d bytes, provider wants %d bytes",
chunks.MaxStateStoreChunkSize, chunkSize,
))
return diags
}
// Negotiated chunk size is valid, so set it in the provider server
// that will use the value for future RPCs to read/write state.
cs := p.provider.(providers.StateStoreChunkSizeSetter)
cs.SetStateStoreChunkSize(p.typeName, int(chunkSize))
log.Printf("[TRACE] Pluggable.Configure: negotiated a chunk size of %v when configuring state store %s",
chunkSize,
p.typeName,
)
return resp.Diagnostics
}
View on GitHub (pinned to c9def3e214)
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.
Defensive patterns
Strategy: validation
Validate before calling
// Validate provider chunk size contract before relying on it.
if resp.Capabilities.ChunkSize == 0 || resp.Capabilities.ChunkSize > chunks.MaxStateStoreChunkSize {
return errors.New("provider returned invalid chunk size")
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- encountered a malformed backend state file with a 'state_sto
- attempted to encode a malformed backend state file; provider
- state store is not valid: %w
- state store is not valid: provider version data is missing d
- Attempted to initialize pluggable state with a nil provider
AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07).
Data as JSON: /api/errors/92cb03a65270a42b.
Report an issue: GitHub.