{"record":{"id":"ac7bd616bf3d922d","repo":"micro-editor/micro","slug":"error-loading-colorscheme-s","errorCode":null,"errorMessage":"Error loading colorscheme: %s","messagePattern":"Error loading colorscheme: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/colorscheme.go","lineNumber":85,"sourceCode":"\n\treturn err\n}\n\n// LoadDefaultColorscheme loads the default colorscheme from $(ConfigDir)/colorschemes\nfunc LoadDefaultColorscheme() (map[string]tcell.Style, error) {\n\tvar parsedColorschemes []string\n\treturn LoadColorscheme(GlobalSettings[\"colorscheme\"].(string), &parsedColorschemes)\n}\n\n// LoadColorscheme loads the given colorscheme from a directory\nfunc LoadColorscheme(colorschemeName string, parsedColorschemes *[]string) (map[string]tcell.Style, error) {\n\tc := make(map[string]tcell.Style)\n\tfile := FindRuntimeFile(RTColorscheme, colorschemeName)\n\tif file == nil {\n\t\treturn c, errors.New(colorschemeName + \" is not a valid colorscheme\")\n\t}\n\tif data, err := file.Data(); err != nil {\n\t\treturn c, errors.New(\"Error loading colorscheme: \" + err.Error())\n\t} else {\n\t\tvar err error\n\t\tc, err = ParseColorscheme(file.Name(), string(data), parsedColorschemes)\n\t\tif err != nil {\n\t\t\treturn c, err\n\t\t}\n\t}\n\treturn c, nil\n}\n\n// ParseColorscheme parses the text definition for a colorscheme and returns the corresponding object\n// Colorschemes are made up of color-link statements linking a color group to a list of colors\n// For example, color-link keyword (blue,red) makes all keywords have a blue foreground and\n// red background\nfunc ParseColorscheme(name string, text string, parsedColorschemes *[]string) (map[string]tcell.Style, error) {\n\tvar err error\n\tcolorParser := regexp.MustCompile(`color-link\\s+(\\S*)\\s+\"(.*)\"`)\n\tincludeParser := regexp.MustCompile(`include\\s+\"(.*)\"`)","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/micro-editor/micro/blob/1c8b82b32e408a5faf340039ed92d5266bea3293/internal/config/colorscheme.go#L67-L103","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"# before:\nls -l ~/.config/micro/colorschemes/zenburn.micro  # -rw------- root root\n# load -> Error loading colorscheme: ... permission denied\n\n# after:\nsudo chown $USER ~/.config/micro/colorschemes/zenburn.micro\nchmod 644 ~/.config/micro/colorschemes/zenburn.micro","handlingStrategy":"try-catch","validationCode":"func readableSchemeFile(name string) bool {\n    f := config.FindRuntimeFile(config.RTColorscheme, name)\n    if f == nil {\n        return false\n    }\n    _, err := f.Data()\n    return err == nil\n}","typeGuard":null,"tryCatchPattern":"styles, err := config.LoadColorscheme(name, &parsed)\nif err != nil && strings.HasPrefix(err.Error(), \"Error loading colorscheme:\") {\n    // I/O problem with the file: fall back to default and surface a warning\n    styles, err = config.LoadColorscheme(\"default\", &parsed)\n}","preventionTips":["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."],"tags":["colorscheme","io","permissions","config"],"backgroundTag":null,"analyzedSha":"1c8b82b32e408a5faf340039ed92d5266bea3293","analyzedAt":"2026-08-15T20:01:45.134Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}