JanDeDobbeleer/oh-my-posh · error
key-value delimiter not found:
Error message
key-value delimiter not found:
What it means
Every non-blank, non-section, non-comment line in an INI file must contain a key-value delimiter '=' or ':'. If IndexAny finds neither, the line cannot be parsed as a key-value pair and the error echoes the line. This keeps the parser strict rather than silently skipping garbage.
Source
Thrown at src/ini/ini.go:63
line = strings.TrimSpace(line)
if line == "" || line[0] == '#' || line[0] == ';' {
continue
}
if line[0] == '[' {
name, _, found := strings.CutLast(line, "]")
if !found {
return nil, errors.New("unclosed section: " + line)
}
current = file.section(strings.TrimSpace(name[1:]))
continue
}
delim := strings.IndexAny(line, "=:")
if delim < 0 {
return nil, errors.New("key-value delimiter not found: " + line)
}
name := strings.TrimSpace(line[:delim])
value := parseValue(line[delim+1:], verbatim)
if _, ok := current.keys[name]; ok {
continue
}
key := &Key{name: name, value: value}
current.keys[name] = key
current.order = append(current.order, key)
}
return file, nil
}
func parseValue(value string, verbatim bool) string {View on GitHub (pinned to 0976794618)
Solutions
- Fix the reported line so the key is followed by '=' or ':' and a value
- Join accidentally wrapped lines back into a single 'key = value' line
- Convert the value syntax if the file was authored in another format (JSON/YAML) and rename it accordingly
Example fix
// before (file content) enable_icons // after (file content) enable_icons = true
Defensive patterns
Strategy: validation
Validate before calling
for i, line := range lines {
l := strings.TrimSpace(line)
if l == "" || strings.HasPrefix(l, "[") || strings.HasPrefix(l, "#") {
continue
}
if !strings.ContainsAny(l, "=:") {
return fmt.Errorf("line %d: missing key-value delimiter", i+1)
}
} Type guard
func isKeyValueLine(line string) bool {
l := strings.TrimSpace(line)
return l != "" && !strings.HasPrefix(l, "[") && !strings.HasPrefix(l, "#") && strings.ContainsAny(l, "=:")
} Try / catch
file, err := ini.Load(path)
if err != nil {
if strings.Contains(err.Error(), "delimiter not found") {
return fmt.Errorf("config %s has a malformed line: %w", path, err)
}
return err
} Prevention
- Never wrap 'key = value' across multiple lines
- Run a schema/lint check on configs in CI
- Convert configs from JSON/YAML instead of pasting lines into INI
When it happens
Trigger: parse() (via Load or LoadVerbatim) reads a line that isn't a section header or comment but contains no '=' or ':' - e.g. 'enable_icons' instead of 'enable_icons = true'.
Common situations: Missing '=' after a key when hand-editing a theme; pasting JSON/YAML-style keys into an INI/TOML config; a wrapped line from a bad copy-paste splitting 'key = value' across lines.
Related errors
- unclosed section:
- section does not exist:
- failed to parse theme %s
- failed to parse data file: %w
- invalid export format
AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31).
Data as JSON: /api/errors/ff71a595c2a6b5d5.
Report an issue: GitHub.