micro-editor/micro · error
Error loading colorscheme: %s
Error message
Error loading colorscheme: %s
What it means
Returned by LoadColorscheme when the colorscheme file IS found (FindRuntimeFile succeeded) but reading its contents via file.Data() fails. The underlying read error is wrapped with 'Error loading colorscheme: '. This is an I/O failure on an already-located runtime file, distinct from error 25 which is a lookup failure.
Source
Thrown at internal/config/colorscheme.go:85
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) {
var err error
colorParser := regexp.MustCompile(`color-link\s+(\S*)\s+"(.*)"`)
includeParser := regexp.MustCompile(`include\s+"(.*)"`)View on GitHub (pinned to 1c8b82b32e)
Solutions
- Check permissions on the named file: chmod 644 ~/.config/micro/colorschemes/<name>.micro and chown it to your user.
- If root-owned files exist from past sudo runs: sudo chown -R $USER:$USER ~/.config/micro.
- Reinstall the colorscheme or plugin that provided the file so it is readable.
- For custom builds, verify the runtime assets were embedded (file.Data() on assetFile must find the bundled copy).
Example fix
# before: ls -l ~/.config/micro/colorschemes/zenburn.micro # -rw------- root root # load -> Error loading colorscheme: ... permission denied # after: sudo chown $USER ~/.config/micro/colorschemes/zenburn.micro chmod 644 ~/.config/micro/colorschemes/zenburn.micro
Defensive patterns
Strategy: try-catch
Validate before calling
func readableSchemeFile(name string) bool {
f := config.FindRuntimeFile(config.RTColorscheme, name)
if f == nil {
return false
}
_, err := f.Data()
return err == nil
} Try / catch
styles, err := config.LoadColorscheme(name, &parsed)
if err != nil && strings.HasPrefix(err.Error(), "Error loading colorscheme:") {
// I/O problem with the file: fall back to default and surface a warning
styles, err = config.LoadColorscheme("default", &parsed)
} Prevention
- Keep ~/.config/micro/colorschemas files chmod 644 and owned by your user.
- Avoid running micro via sudo; it creates root-owned scheme files that later fail to read.
- When packaging plugins, verify every registered runtime file is actually readable at install time.
When it happens
Trigger: A .micro file registered under ~/.config/micro/colorschemes (or a plugin dir) that has mode 000 or is owned by another user, a file deleted between registration and load, or a packaged asset path that is missing in a stripped binary distribution. Fires at internal/config/colorscheme.go:85 when file.Data() returns err.
Common situations: Config dir restored from a backup with wrong ownership/permissions, sudo-launched micro creating root-owned scheme files that a later normal user run cannot read, or a broken plugin install whose colorscheme file was half-removed.
Related errors
- Error reading bindings.json file: %s
- Error reading settings.json file: %s
- %s is not a valid colorscheme
- Color-link statement is not valid: %s
- Error creating configuration directory: %s
AI-assisted analysis of micro-editor/micro@1c8b82b32e (2026-08-15).
Data as JSON: /api/errors/ac7bd616bf3d922d.
Report an issue: GitHub.