{"record":{"id":"df2aa0663516608b","repo":"micro-editor/micro","slug":"color-link-statement-is-not-valid-s","errorCode":null,"errorMessage":"Color-link statement is not valid: %s","messagePattern":"Color-link statement is not valid: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/colorscheme.go","lineNumber":154,"sourceCode":"\t\t\t\t\tc[k] = v\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tmatches = colorParser.FindSubmatch([]byte(line))\n\t\tif len(matches) == 3 {\n\t\t\tlink := string(matches[1])\n\t\t\tcolors := string(matches[2])\n\n\t\t\tstyle := StringToStyle(colors)\n\t\t\tc[link] = style\n\n\t\t\tif link == \"default\" {\n\t\t\t\tDefStyle = style\n\t\t\t}\n\t\t} else {\n\t\t\terr = errors.New(\"Color-link statement is not valid: \" + line)\n\t\t}\n\t}\n\n\treturn c, err\n}\n\n// StringToStyle returns a style from a string\n// The strings must be in the format \"extra foregroundcolor,backgroundcolor\"\n// The 'extra' can be bold, reverse, italic or underline\nfunc StringToStyle(str string) tcell.Style {\n\tvar fg, bg string\n\tspaceSplit := strings.Split(str, \" \")\n\tsplit := strings.Split(spaceSplit[len(spaceSplit)-1], \",\")\n\tif len(split) > 1 {\n\t\tfg, bg = split[0], split[1]\n\t} else {\n\t\tfg = split[0]\n\t}","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/micro-editor/micro/blob/1c8b82b32e408a5faf340039ed92d5266bea3293/internal/config/colorscheme.go#L136-L172","documentation":"Returned by ParseColorscheme when a non-comment line in a .micro colorscheme file does not match the color-link grammar: it must be a 'color-link <group> <colors>' statement captured by the colorParser regex (3 submatches). The offending line is included verbatim so you can find it; parsing continues and the error is returned after the loop.","triggerScenarios":"Hand-editing a colorscheme and writing 'link color-group red' instead of 'color-link color-group red', missing the color pair, stray characters/quotes around the line, or a plugin-shipped .micro file with a typo. Only lines whose regex match length != 3 hit the branch at internal/config/colorscheme.go:154.","commonSituations":"Users customizing syntax groups in their scheme, copy-pasting scheme snippets from tutorials that use a different syntax, or trailing smart-quotes/punctuation from rich-text editors corrupting lines.","solutions":["Open the named file and go to the reported line; rewrite it as: color-link <group> <fg>,<bg> (bg optional), e.g. color-link keyword bold red,#222222.","Ensure every non-comment line starts with 'color-link '; prefix unused lines with '#'.","Validate after editing: run `micro` and `set colorscheme <name>` again; the error line text tells you exactly which statement failed.","If the scheme came from a plugin, update/reinstall the plugin to get a fixed file."],"exampleFix":"# before (~/.config/micro/colorschemes/mine.micro):\nlink identifier blue\ncolor-link keyword red\n\n# after:\ncolor-link identifier blue\ncolor-link keyword red","handlingStrategy":"validation","validationCode":"var colorLinkRe = regexp.MustCompile(`^color-link\\s+(\\S+)\\s+(.+)$`)\n\nfunc validSchemeLine(line string) bool {\n    line = strings.TrimSpace(line)\n    return line == \"\" || strings.HasPrefix(line, \"#\") || colorLinkRe.MatchString(line)\n}","typeGuard":null,"tryCatchPattern":"styles, err := config.ParseColorscheme(name, data, &parsed)\nif err != nil && strings.HasPrefix(err.Error(), \"Color-link statement is not valid\") {\n    // report file+line, keep previously loaded styles map as fallback\n}","preventionTips":["Author every non-comment line as 'color-link <group> <fg>,<bg>'.","Lint custom schemes by loading them once in a scratch micro instance before making them the default.","When generating schemes programmatically, emit only matched statements; never pass through raw user text lines."],"tags":["colorscheme","parsing","syntax","config"],"backgroundTag":null,"analyzedSha":"1c8b82b32e408a5faf340039ed92d5266bea3293","analyzedAt":"2026-08-15T20:01:45.134Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}