amir20/dozzle · error
invalid format: unexpected key without value
Error message
invalid format: unexpected key without value
What it means
After the final key=value pair the input still contains trailing text where a key is expected (isKey true with unparsed input left). This is a dangling key with no '=' and value, e.g. 'a=1 b', so the line is rejected as malformed logfmt.
Solutions
- Add a value for the dangling key, e.g. 'a=1 b=2'.
- Remove the stray trailing token from the log line.
- If trailing tokens are acceptable upstream, catch the error and parse only the valid prefix or log the line unstructured.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/container/logfmt.go:69 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07).
Data as JSON: /api/errors/cbe82cb440676a2a.
Report an issue: GitHub.
Appendix: source
Thrown at internal/container/logfmt.go:69
} else if char == ' ' {
value = log[start:i]
result.Set(key, value)
isKey = true
start = i + 1
}
}
}
}
// Handle the last key-value pair if there is no trailing space
if !isKey && start < len(log) {
if inQuotes {
return nil, errors.New("invalid format: unclosed quotes")
}
value = log[start:]
result.Set(key, value)
} else if isKey && start < len(log) {
return nil, errors.New("invalid format: unexpected key without value")
}
if !isKey {
if inQuotes {
return nil, errors.New("invalid format: unclosed quotes")
}
value = log[start:]
result.Set(key, value)
}
return result, nil
}
// unescapeQuoted decodes a quoted logfmt value (including the surrounding
// quotes) so escape sequences like \" and \\ produced by logfmt encoders
// (logrus, go-kit, go-logfmt) yield the original text instead of leaking
// backslashes into the parsed value. If the sequence is not decodable, the
// raw content between the quotes is returned unchanged.View on GitHub (pinned to d9463cbe21)