micro-editor/micro · error
%s is not a valid colorscheme
Error message
%s is not a valid colorscheme
What it means
Returned by config.LoadColorscheme when FindRuntimeFile(RTColorscheme, name) returns nil, i.e. no colorscheme file with that name is registered in any runtime search location (packaged runtime/colorschemes, ~/.config/micro/colorschemes, or plugin-contributed files). The returned map is empty, so callers fall back to whatever style map they had.
Source
Thrown at internal/config/colorscheme.go:82
Colorscheme = c
}
}
return err
}
// LoadDefaultColorscheme loads the default colorscheme from $(ConfigDir)/colorschemes
func LoadDefaultColorscheme() (map[string]tcell.Style, error) {
var parsedColorschemes []string
return LoadColorscheme(GlobalSettings["colorscheme"].(string), &parsedColorschemes)
}
// LoadColorscheme loads the given colorscheme from a directory
func LoadColorscheme(colorschemeName string, parsedColorschemes *[]string) (map[string]tcell.Style, error) {
c := make(map[string]tcell.Style)
file := FindRuntimeFile(RTColorscheme, colorschemeName)
if file == nil {
return c, errors.New(colorschemeName + " is not a valid colorscheme")
}
if data, err := file.Data(); err != nil {
return c, errors.New("Error loading colorscheme: " + err.Error())
} else {
var err error
c, err = ParseColorscheme(file.Name(), string(data), parsedColorschemes)
if err != nil {
return c, err
}
}
return c, nil
}
// ParseColorscheme parses the text definition for a colorscheme and returns the corresponding object
// Colorschemes are made up of color-link statements linking a color group to a list of colors
// For example, color-link keyword (blue,red) makes all keywords have a blue foreground and
// red background
func ParseColorscheme(name string, text string, parsedColorschemes *[]string) (map[string]tcell.Style, error) {View on GitHub (pinned to 1c8b82b32e)
Solutions
- List what exists: `set colorscheme ` + Tab completion, or ls ~/.config/micro/colorschemes and the packaged runtime/colorschemes directory.
- Fix the name/casing to match the file basename exactly (file minus .micro extension).
- Install the scheme: download the .micro file into ~/.config/micro/colorschemes/ and retry.
- If packaged schemes are missing (custom build), rebuild so runtime assets are embedded/bundled, or copy the colorschemes dir next to the binary.
Example fix
# before: > set colorscheme gruvbox # file is gruvbox-boxy.micro? no -> error # after: mv ~/Downloads/gruvbox.micro ~/.config/micro/colorschemes/ > set colorscheme gruvbox
Defensive patterns
Strategy: validation
Validate before calling
func colorschemeExists(name string) bool {
return config.FindRuntimeFile(config.RTColorscheme, name) != nil
}
if !colorschemeExists(next) {
// keep current scheme instead of applying next
} Type guard
func isAvailableColorscheme(name string) bool {
for _, f := range config.ListRuntimeFiles(config.RTColorscheme) {
if f.Name() == name {
return true
}
}
return false
} Try / catch
styles, err := config.LoadColorscheme(name, &parsed)
if err != nil {
if strings.HasSuffix(err.Error(), "is not a valid colorscheme") {
styles, err = config.LoadColorscheme("default", &parsed) // safe fallback
}
} Prevention
- Before writing "colorscheme" to settings.json or a theme switcher, check it against config.ListRuntimeFiles(RTColorscheme).
- Ship custom .micro files inside ~/.config/micro/colorschemes with the exact basename you reference.
- In theme plugins, register scheme files via AddRuntimeFile so they are discoverable.
When it happens
Trigger: Running `set colorscheme solarized` when no solarized.micro exists, putting "colorscheme": "darcula" in settings.json without installing darcula.micro, or a plugin that contributed the scheme not being loaded. LoadDefaultColorscheme at internal/config/colorscheme.go:82 uses GlobalSettings["colorscheme"], so a bad name breaks startup loading too.
Common situations: Typos and casing mistakes (Micro must find e.g. 'solarized' matching solarized.micro), copying a settings.json from a machine where a custom scheme was installed, or extracting/shipping a micro binary without its runtime/colorschemes assets.
Related errors
- Error loading colorscheme: %s
- Color-link statement is not valid: %s
- Aborted
- Invalid event %s
- %s is not a bindable event
AI-assisted analysis of micro-editor/micro@1c8b82b32e (2026-08-15).
Data as JSON: /api/errors/6e07d01fe6ac5ffb.
Report an issue: GitHub.