micro-editor/micro · error
Invalid option
Error message
Invalid option
What it means
Sentinel error config.ErrInvalidOption from config.GetNativeValue when GetGlobalOption(option) returns nil, i.e. the option name is not present in the merged defaults (defaultCommonSettings + DefaultGlobalOnlySettings). It means you asked to set an option micro does not know. The same sentinel is reused by the command layer (`set` in the command bar) and buffer-local settings.
Source
Thrown at internal/config/settings.go:145
"pluginchannels": []string{"https://raw.githubusercontent.com/micro-editor/plugin-channel/master/channel.json"},
"pluginrepos": []string{},
"savehistory": true,
"scrollbarchar": "|",
"sucmd": "sudo",
"tabalways": false,
"tabhighlight": false,
"tabreverse": true,
"xterm": false,
}
// a list of settings that should never be globally modified
var LocalSettings = []string{
"filetype",
"readonly",
}
var (
ErrInvalidOption = errors.New("Invalid option")
ErrInvalidValue = errors.New("Invalid value")
ErrOptNotToggleable = errors.New("Option not toggleable")
// The options that the user can set
GlobalSettings map[string]any
// This is the raw parsed json
parsedSettings map[string]any
settingsParseError bool
// ModifiedSettings is a map of settings which should be written to disk
// because they have been modified by the user in this session
ModifiedSettings map[string]bool
// VolatileSettings is a map of settings which should not be written to disk
// because they have been temporarily set for this session only
VolatileSettings map[string]bool
)View on GitHub (pinned to 1c8b82b32e)
Solutions
- List valid options: type `set ` and use Tab completion in the command bar, or check the options help for your version.
- Fix the spelling: common ones are 'relativenumber' (not relativenumbers), 'softtabs' vs 'tabsize' — match the documented name exactly.
- If an option vanished after upgrading, check the release notes/changelog for its rename and use the new name.
- Programmatic callers: verify with config.GetGlobalOption(name) != nil before setting.
Example fix
; before (command bar): > set relativenumbers true ; error: Invalid option ; after: > set relatenumber off -> no; correct name: > set relatenumber -> no; use: > set relativenumber true
Defensive patterns
Strategy: validation
Validate before calling
func optionExists(name string) bool {
return config.GetGlobalOption(name) != nil // nil means unknown to micro
}
if optionExists(next) {
config.SetGlobalOption(name, value)
} Type guard
func isKnownOption(name string) bool {
_, known := config.DefaultAllSettings()[name]
return known
} Try / catch
val, err := config.GetNativeValue(name, strVal)
if err != nil {
if errors.Is(err, config.ErrInvalidOption) {
// name is wrong: suggest from config.DefaultAllSettings() keys, abort set
}
} Prevention
- Discover options via `set` + Tab completion instead of typing names from memory.
- In scripts driving micro, validate names against config.DefaultAllSettings() first.
- After a micro upgrade, re-check custom option lists for removed/renamed names.
When it happens
Trigger: Running `set relativenumbers true` (name doesn't exist; the real option is 'relativenumber'), or programmatically config.GetNativeValue('softtab', '2') — evaluated against the defaults maps in internal/config/settings.go:145/504. Any typo'd or removed option name produces exactly this error.
Common situations: Typos at the command bar, options removed/renamed across micro versions (settings.json keys, however, are kept as unknown without this error), and tutorials referencing options that don't exist in the user's micro version.
Related errors
- Invalid value
- bindings is locked by the user
- Parent dirs don't exist, enable 'mkparents' for auto creatio
- Error with glob setting %s: %s
- Error reading settings.json file: %s
AI-assisted analysis of micro-editor/micro@1c8b82b32e (2026-08-15).
Data as JSON: /api/errors/8fd359aee753fd77.
Report an issue: GitHub.