hashicorp/terraform · error
%s: %s
Error message
%s: %s
What it means
Raised in inputForSchema when an interactive prompt for a required provider/backend attribute fails to read a value. The message is formatted as 'attrName: underlyingError'. inputForSchema walks schema.Attributes for Required+null+primitive attributes and prompts for each; an I/O failure reading the answer produces this.
Source
Thrown at internal/command/meta_config.go:403
for name, attrS := range schema.Attributes {
if attrS.Required && retVals[name].IsNull() && attrS.Type.IsPrimitiveType() {
names = append(names, name)
}
}
sort.Strings(names)
input := m.UIInput()
for _, name := range names {
attrS := schema.Attributes[name]
for {
strVal, err := input.Input(context.Background(), &terraform.InputOpts{
Id: name,
Query: name,
Description: attrS.Description,
})
if err != nil {
return cty.UnknownVal(schema.ImpliedType()), fmt.Errorf("%s: %s", name, err)
}
val := cty.StringVal(strVal)
val, err = convert.Convert(val, attrS.Type)
if err != nil {
m.showDiagnostics(fmt.Errorf("Invalid value: %s", err))
continue
}
retVals[name] = val
break
}
}
return cty.ObjectVal(retVals), nil
}
// configSources returns the source cache from the receiver's config loader,View on GitHub (pinned to c9def3e214)
Solutions
- Supply all required attributes explicitly in the config so no prompt is needed.
- Run with -input=false to fail fast with a clear 'missing required attribute' diagnostic instead of an I/O error.
- Keep stdin open / allocate a TTY for interactive runs.
- Validate the backend block has all required keys before running init.
Example fix
// before
// backend "s3" block missing 'bucket', init prompts with closed stdin
// after
// fill required attrs in config:
backend "s3" { bucket = "my-bucket" region = "us-east-1" key = "tfstate" } Defensive patterns
Strategy: validation
Validate before calling
// Provide all required backend/provider attributes in config so no prompt
// is needed. Validate required keys before init.
required := []string{"bucket", "region", "key"}
for _, k := range required {
if !backendBlock.HasAttribute(k) {
return fmt.Errorf("missing required backend attribute %s", k)
}
} Prevention
- Fill all required attributes in the backend/provider config blocks.
- Run init with -input=false to get clear 'missing attribute' errors instead of I/O errors.
- Validate the config (terraform validate) before init.
- Keep stdin open if relying on interactive attribute entry.
When it happens
Trigger: inputForSchema: input.Input(...) returns err!=nil for some required attribute name. Reached during backend/provider config init when required attributes are unset and interactive input is attempted but the reader fails (closed stdin, no TTY).
Common situations: CI/automation running init without -input=false where a required backend attribute is missing; closed stdin during an interactive backend config; terminal disconnect mid-prompt.
Related errors
- Invalid value: %s
- The -upgrade flag conflicts with -lockfile=readonly.
- credentials file %s has invalid value for "credentials" prop
- Can't serialize backend configuration as JSON: %s
- Failed to set state store configuration: %w
AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07).
Data as JSON: /api/errors/ace4c632cb970b14.
Report an issue: GitHub.