amir20/dozzle · error
invalid end time format (expected RFC3339)
Error message
invalid end time format (expected RFC3339): %w
What it means
Same validation as the start time, applied to args.End. A non-empty end argument that fails time.Parse(time.RFC3339, ...) is wrapped as 'invalid end time format (expected RFC3339)'. Defaults to time.Now() when omitted.
Solutions
- Pass end as full RFC3339 with timezone, e.g. 2024-05-01T10:00:00Z
- Omit end (defaults to now)
- Validate the timestamp client-side with a strict RFC3339 parser before the call
Example fix
// before
{"container_id":"abc","end":"now"}
// after
{"container_id":"abc","end":"2024-05-01T10:00:00Z"} Defensive patterns
Strategy: validation
Validate before calling
function isValidRFC3339(s) { if (!s) return true; return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/.test(s) && !isNaN(Date.parse(s)); }
if (args.end && !isValidRFC3339(args.end)) args.end = new Date().toISOString(); Type guard
null
Prevention
- Use toISOString() for end boundaries
- Include timezone offset always (Z or ±hh:mm)
- Omit end when you want 'now'
When it happens
Trigger: Calling fetch_container_logs with args.end like 'now', '2024/05/01', '1700000000', or an RFC3339-like string lacking an offset ('2024-05-01T10:00:00').
Common situations: Tool callers using locale-specific date formatting; unix epoch integers passed as end boundaries; partial ISO dates without seconds or zone.
Related errors
- invalid start time format (expected RFC3339)
- unknown action
- invalid regex pattern
- is required
- container_id is required
AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07).
Data as JSON: /api/errors/5250268cc59b0e5c.
Report an issue: GitHub.
Appendix: source
Thrown at internal/cloud/tools_logs.go:52
cs, err := deps.HostService.FindContainer(hostID, containerID, deps.Labels)
if err != nil {
return nil, fmt.Errorf("container not found: %w", err)
}
start := time.Now().Add(-1 * time.Hour)
end := time.Now()
if args.Start != "" {
t, err := time.Parse(time.RFC3339, args.Start)
if err != nil {
return nil, fmt.Errorf("invalid start time format (expected RFC3339): %w", err)
}
start = t
}
if args.End != "" {
t, err := time.Parse(time.RFC3339, args.End)
if err != nil {
return nil, fmt.Errorf("invalid end time format (expected RFC3339): %w", err)
}
end = t
}
var re *regexp.Regexp
if args.Regex != "" {
var err error
re, err = regexp.Compile(args.Regex)
if err != nil {
return nil, fmt.Errorf("invalid regex pattern: %w", err)
}
}
ctx, cancel := context.WithCancel(ctx)
defer cancel()
logCh, err := cs.LogsBetweenDates(ctx, start, end, container.STDOUT|container.STDERR)
if err != nil {View on GitHub (pinned to d9463cbe21)