micro-editor/micro · warning

Error with glob setting %s: %s

Error message

Error with glob setting %s: %s

What it means

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.

Source

Thrown at internal/config/settings.go:192

func validateParsedSettings() error {
	var err error
	defaults := DefaultAllSettings()
	for k, v := range parsedSettings {
		if strings.HasPrefix(reflect.TypeOf(v).String(), "map") {
			if strings.HasPrefix(k, "ft:") {
				for k1, v1 := range v.(map[string]any) {
					if _, ok := defaults[k1]; ok {
						if e := verifySetting(k1, v1, defaults[k1]); e != nil {
							err = e
							parsedSettings[k].(map[string]any)[k1] = defaults[k1]
							continue
						}
					}
				}
			} else {
				tk := strings.TrimPrefix(k, "glob:")
				if _, e := glob.Compile(tk); e != nil {
					err = errors.New("Error with glob setting " + tk + ": " + e.Error())
					delete(parsedSettings, k)
					continue
				}
				if !strings.HasPrefix(k, "glob:") {
					// Support non-prefixed glob settings but internally convert
					// them to prefixed ones for simplicity.
					delete(parsedSettings, k)
					k = "glob:" + k
					parsedSettings[k] = v
				}
				for k1, v1 := range v.(map[string]any) {
					if _, ok := defaults[k1]; ok {
						if e := verifySetting(k1, v1, defaults[k1]); e != nil {
							err = e
							parsedSettings[k].(map[string]any)[k1] = defaults[k1]
							continue
						}
					}

View on GitHub (pinned to 1c8b82b32e)

Solutions

  1. Fix the pattern using gobwas/glob syntax: '*' any run, '?' single char, '{a,b}' alternation, '[abc]' classes — ensure braces/brackets are balanced.
  2. Prefer the explicit 'glob:' prefix so the key is unambiguous.
  3. Remove the broken key entirely — micro already deletes it from the parsed settings, so the session runs with defaults for those files.
  4. Test patterns before adding: `echo '*.go' | ...` or a quick Go snippet with github.com/gobwas/glob.

Example fix

// before (settings.json):
{ "glob:*.{go": { "tabsize": 4 } }

// after:
{ "glob:*.{go}": { "tabsize": 4 } }
Defensive patterns

Strategy: validation

Validate before calling

import "github.com/gobwas/glob"

func validGlobKey(key string) bool {
    _, err := glob.Compile(strings.TrimPrefix(key, "glob:"))
    return err == nil
}

// before writing settings.json programmatically:
if !validGlobKey(pattern) { /* drop or fix the key */ }

Try / catch

if err := config.ReadSettings(); err != nil {
    if strings.HasPrefix(err.Error(), "Error with glob setting") {
        // micro already dropped the bad key; open settings.json and fix the pattern
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of micro-editor/micro@1c8b82b32e (2026-08-15). Data as JSON: /api/errors/be98663a81cd0f78. Report an issue: GitHub.