amir20/dozzle · error
invalid filter
Error message
invalid filter: %s
What it means
ParseContainerFilter converts a comma-separated 'key=value' filter string into a map. If any comma-separated token lacks an '=' separator the whole parse fails with 'invalid filter'. Used to translate user-supplied label filters into Docker API filters.
Solutions
- Write each token as key=value, comma-separated with no bare values
- For label filtering use the form 'label=key' or 'label=key=value' as the Docker API expects
- Remove empty segments caused by trailing/double commas
Example fix
// before
ParseContainerFilter("label=env,prod")
// after
ParseContainerFilter("label=env,label=prod") Defensive patterns
Strategy: validation
Validate before calling
func validFilter(f string) bool {
for _, tok := range strings.Split(f, ",") {
if !strings.Contains(tok, "=") { return false }
}
return true
} Prevention
- Always write filter tokens as key=value
- Avoid bare label names; prefix with 'label='
- Strip trailing commas and spaces from user-supplied filter strings
When it happens
Trigger: ParseContainerFilter receives a filter string where a token between commas has no '=' (e.g. 'label=env,prod' where 'prod' has no key). Raised in the strings.SplitSeq loop when strings.Cut returns ok=false. Also hit via decodeUsersFromFile paths.
Common situations: Typo omitting '=' between key and value; label name-only filtering without 'label=' prefix; spaces or trailing commas creating bare tokens; copied filter strings losing characters.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07).
Data as JSON: /api/errors/33f4117c687f45a1.
Report an issue: GitHub.
Appendix: source
Thrown at internal/container/types.go:238
Host string `json:"host"`
ActorID string `json:"actorId"`
ActorAttributes map[string]string `json:"actorAttributes,omitempty"`
Time time.Time `json:"time"`
Container *Container `json:"-"`
}
type ContainerLabels map[string][]string
func ParseContainerFilter(commaValues string) (ContainerLabels, error) {
filter := make(ContainerLabels)
if commaValues == "" {
return filter, nil
}
for val := range strings.SplitSeq(commaValues, ",") {
before, after, ok := strings.Cut(val, "=")
if !ok {
return nil, fmt.Errorf("invalid filter: %s", filter)
}
key := before
val := after
filter[key] = append(filter[key], val)
}
return filter, nil
}
func (f ContainerLabels) Exists() bool {
return len(f) > 0
}
type LogPosition string
const (
Beginning LogPosition = "start"
Middle LogPosition = "middle"View on GitHub (pinned to d9463cbe21)