{"record":{"id":"be98663a81cd0f78","repo":"micro-editor/micro","slug":"error-with-glob-setting-s-s","errorCode":null,"errorMessage":"Error with glob setting %s: %s","messagePattern":"Error with glob setting (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/config/settings.go","lineNumber":192,"sourceCode":"func validateParsedSettings() error {\n\tvar err error\n\tdefaults := DefaultAllSettings()\n\tfor k, v := range parsedSettings {\n\t\tif strings.HasPrefix(reflect.TypeOf(v).String(), \"map\") {\n\t\t\tif strings.HasPrefix(k, \"ft:\") {\n\t\t\t\tfor k1, v1 := range v.(map[string]any) {\n\t\t\t\t\tif _, ok := defaults[k1]; ok {\n\t\t\t\t\t\tif e := verifySetting(k1, v1, defaults[k1]); e != nil {\n\t\t\t\t\t\t\terr = e\n\t\t\t\t\t\t\tparsedSettings[k].(map[string]any)[k1] = defaults[k1]\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttk := strings.TrimPrefix(k, \"glob:\")\n\t\t\t\tif _, e := glob.Compile(tk); e != nil {\n\t\t\t\t\terr = errors.New(\"Error with glob setting \" + tk + \": \" + e.Error())\n\t\t\t\t\tdelete(parsedSettings, k)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif !strings.HasPrefix(k, \"glob:\") {\n\t\t\t\t\t// Support non-prefixed glob settings but internally convert\n\t\t\t\t\t// them to prefixed ones for simplicity.\n\t\t\t\t\tdelete(parsedSettings, k)\n\t\t\t\t\tk = \"glob:\" + k\n\t\t\t\t\tparsedSettings[k] = v\n\t\t\t\t}\n\t\t\t\tfor k1, v1 := range v.(map[string]any) {\n\t\t\t\t\tif _, ok := defaults[k1]; ok {\n\t\t\t\t\t\tif e := verifySetting(k1, v1, defaults[k1]); e != nil {\n\t\t\t\t\t\t\terr = e\n\t\t\t\t\t\t\tparsedSettings[k].(map[string]any)[k1] = defaults[k1]\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/micro-editor/micro/blob/1c8b82b32e408a5faf340039ed92d5266bea3293/internal/config/settings.go#L174-L210","documentation":"Returned during ReadSettings validation when a settings.json key treated as a glob pattern (the 'glob:' prefix, or any key whose value is a map) fails to compile with glob.Compile. The bad key is deleted from parsedSettings so the rest of the file still loads, and the compile error text is appended.","triggerScenarios":"A settings.json containing {\"glob:*.{go,\": {...}} — unbalanced brace is an invalid pattern for the gobwas/glob compiler; or a non-prefixed key like \"*.go\" with a malformed pattern being normalized to 'glob:*.go'. Validation at internal/config/settings.go:192 trims the prefix and compiles.","commonSituations":"Users writing per-filetype settings with glob keys and making brace/extglob syntax mistakes, or pasting glob examples from other editors (VSCode glob dialect) whose syntaxes differ.","solutions":["Fix the pattern using gobwas/glob syntax: '*' any run, '?' single char, '{a,b}' alternation, '[abc]' classes — ensure braces/brackets are balanced.","Prefer the explicit 'glob:' prefix so the key is unambiguous.","Remove the broken key entirely — micro already deletes it from the parsed settings, so the session runs with defaults for those files.","Test patterns before adding: `echo '*.go' | ...` or a quick Go snippet with github.com/gobwas/glob."],"exampleFix":"// before (settings.json):\n{ \"glob:*.{go\": { \"tabsize\": 4 } }\n\n// after:\n{ \"glob:*.{go}\": { \"tabsize\": 4 } }","handlingStrategy":"validation","validationCode":"import \"github.com/gobwas/glob\"\n\nfunc validGlobKey(key string) bool {\n    _, err := glob.Compile(strings.TrimPrefix(key, \"glob:\"))\n    return err == nil\n}\n\n// before writing settings.json programmatically:\nif !validGlobKey(pattern) { /* drop or fix the key */ }","typeGuard":null,"tryCatchPattern":"if err := config.ReadSettings(); err != nil {\n    if strings.HasPrefix(err.Error(), \"Error with glob setting\") {\n        // micro already dropped the bad key; open settings.json and fix the pattern\n    }\n}","preventionTips":["Test glob keys with gobwas/glob syntax before adding them ({a,b} alternation, *, ?, [class]).","Always prefix pattern keys with 'glob:' to avoid ambiguity with future option names.","Keep one glob key per line and validate the file after every manual edit by restarting micro."],"tags":["settings","glob","config","validation"],"backgroundTag":null,"analyzedSha":"1c8b82b32e408a5faf340039ed92d5266bea3293","analyzedAt":"2026-08-15T20:01:45.134Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}