{"record":{"id":"0c58827b6853eca0","repo":"hashicorp/terraform","slug":"invalid-value-s","errorCode":null,"errorMessage":"Invalid value: %s","messagePattern":"Invalid value: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/command/meta_config.go","lineNumber":409,"sourceCode":"\n\tinput := m.UIInput()\n\tfor _, name := range names {\n\t\tattrS := schema.Attributes[name]\n\n\t\tfor {\n\t\t\tstrVal, err := input.Input(context.Background(), &terraform.InputOpts{\n\t\t\t\tId:          name,\n\t\t\t\tQuery:       name,\n\t\t\t\tDescription: attrS.Description,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn cty.UnknownVal(schema.ImpliedType()), fmt.Errorf(\"%s: %s\", name, err)\n\t\t\t}\n\n\t\t\tval := cty.StringVal(strVal)\n\t\t\tval, err = convert.Convert(val, attrS.Type)\n\t\t\tif err != nil {\n\t\t\t\tm.showDiagnostics(fmt.Errorf(\"Invalid value: %s\", err))\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tretVals[name] = val\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn cty.ObjectVal(retVals), nil\n}\n\n// configSources returns the source cache from the receiver's config loader,\n// which the caller must not modify.\n//\n// If a config loader has not yet been instantiated then no files could have\n// been loaded already, so this method returns a nil map in that case.\nfunc (m *Meta) configSources() map[string][]byte {\n\tif m.configLoader == nil {","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/meta_config.go#L391-L427","documentation":"Raised in inputForSchema when the user-supplied string for a required attribute cannot be converted to the attribute's declared type (e.g. non-numeric string into a number attribute, or malformed bool). The prompt loop re-displays this diagnostic and re-prompts rather than aborting; it is shown interactively, not returned as a fatal error.","triggerScenarios":"inputForSchema: convert.Convert(cty.StringVal(strVal), attrS.Type) returns err!=nil, so m.showDiagnostics(fmt.Errorf(\"Invalid value: %s\", err)) is printed and the loop continues. Example: typing 'abc' for a number attribute, or 'tru' for a bool.","commonSituations":"User typos a boolean (tru/1/yes instead of true); user enters text for a numeric field; user enters a non-URL for a URL-typed attr; confusion about the expected type at a prompt.","solutions":["Re-enter a value of the correct type at the re-prompt (true/false for bool, a valid number for number, etc.).","Check the attribute's schema/type in the provider/backend docs before answering.","Set the attribute in the config file directly to avoid the interactive guess.","Use -input=false and supply values in config for type safety."],"exampleFix":"// before\n// prompt for 'encrypt' (bool): user types 'yes' -> Invalid value\n\n// after\n// prompt for 'encrypt': user types 'true'","handlingStrategy":"validation","validationCode":"// Type-check the value before submitting it at a prompt\nfunc coerce(attrType cty.Type, s string) (cty.Value, error) {\n    return convert.Convert(cty.StringVal(s), attrType)\n}\n// e.g. for bool: only 'true'/'false' pass; for number: valid numeric strings.","typeGuard":"func isValidForType(s string, t cty.Type) bool {\n    _, err := convert.Convert(cty.StringVal(s), t)\n    return err == nil\n}","tryCatchPattern":null,"preventionTips":["Enter values matching the attribute type (true/false, valid numbers, URLs).","Set typed values directly in config to avoid interactive guessing.","Use -input=false and supply all values in config.","Consult provider docs for each attribute's expected type."],"tags":["terraform","init","input-validation","schema","type-conversion"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}