{"record":{"id":"2155919fc1fb97b6","repo":"micro-editor/micro","slug":"invalid-value","errorCode":null,"errorMessage":"Invalid value","messagePattern":"Invalid value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/settings.go","lineNumber":146,"sourceCode":"\t\"pluginrepos\":    []string{},\n\t\"savehistory\":    true,\n\t\"scrollbarchar\":  \"|\",\n\t\"sucmd\":          \"sudo\",\n\t\"tabalways\":      false,\n\t\"tabhighlight\":   false,\n\t\"tabreverse\":     true,\n\t\"xterm\":          false,\n}\n\n// a list of settings that should never be globally modified\nvar LocalSettings = []string{\n\t\"filetype\",\n\t\"readonly\",\n}\n\nvar (\n\tErrInvalidOption    = errors.New(\"Invalid option\")\n\tErrInvalidValue     = errors.New(\"Invalid value\")\n\tErrOptNotToggleable = errors.New(\"Option not toggleable\")\n\n\t// The options that the user can set\n\tGlobalSettings map[string]any\n\n\t// This is the raw parsed json\n\tparsedSettings     map[string]any\n\tsettingsParseError bool\n\n\t// ModifiedSettings is a map of settings which should be written to disk\n\t// because they have been modified by the user in this session\n\tModifiedSettings map[string]bool\n\n\t// VolatileSettings is a map of settings which should not be written to disk\n\t// because they have been temporarily set for this session only\n\tVolatileSettings map[string]bool\n)\n","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/micro-editor/micro/blob/1c8b82b32e408a5faf340039ed92d5266bea3293/internal/config/settings.go#L128-L164","documentation":"Sentinel error config.ErrInvalidValue from config.GetNativeValue when the string value cannot be parsed into the option's existing type: booleans go through util.ParseBool (accepts true/false/1/0/t/f variants — not 'yes'/'on'), numbers through strconv.ParseFloat, and any other underlying kind fails by default. The option name is valid; the value is not.","triggerScenarios":"`set autosave yes` or `set softwrap on` (ParseBool rejects 'yes'/'on'), `set tabsize four` (ParseFloat fails), or `set colorscheme 123` where the value parses but a later validator rejects it. Raised at internal/config/settings.go:146 via 511/519/523.","commonSituations":"Users writing YAML-ish booleans ('yes'/'no', 'on'/'off') in the command bar or in scripts, and JSON settings files where a boolean was quoted (\"true\" as string is fine for strings but numbers quoted like \"2\" for float options go through this parse and pass — while non-numeric strings fail).","solutions":["Use literal booleans: `set autosave true` / `set autosave false` (or 1/0).","Use bare numbers for numeric options: `set tabsize 4`.","In settings.json keep native JSON types: \"autosave\": true, \"tabsize\": 4 — not quoted strings for numbers.","Programmatic: call config.GetNativeValue(name, value) first and handle ErrInvalidValue before applying."],"exampleFix":"; before:\n> set autosave on        ; error: Invalid value\n\n; after:\n> set autosave true","handlingStrategy":"validation","validationCode":"func valueMatchesOption(name, strVal string) bool {\n    cur := config.GetGlobalOption(name)\n    if cur == nil {\n        return false\n    }\n    switch reflect.TypeOf(cur).Kind() {\n    case reflect.Bool:\n        _, e := strconv.ParseBool(strVal); return e == nil\n    case reflect.Float64:\n        _, e := strconv.ParseFloat(strVal, 64); return e == nil\n    case reflect.String:\n        return true\n    }\n    return false\n}","typeGuard":null,"tryCatchPattern":"native, err := config.GetNativeValue(name, strVal)\nif err != nil {\n    if errors.Is(err, config.ErrInvalidValue) {\n        // show expected type: bool -> true/false, number -> digits, keep old value\n    }\n}","preventionTips":["Use only true/false (or 1/0) for booleans; never 'yes'/'on'/'off'.","Keep numbers unquoted in settings.json and untyped at the command bar (`set tabsize 4`).","Validate values with config.GetNativeValue before applying when generating settings programmatically."],"tags":["settings","options","type-mismatch","parsing"],"backgroundTag":null,"analyzedSha":"1c8b82b32e408a5faf340039ed92d5266bea3293","analyzedAt":"2026-08-15T20:01:45.134Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}