amir20/dozzle · error
container_id is required
Error message
container_id is required
What it means
parseStreamArgs requires container_id; after successful JSON unmarshal, an empty container_id string fails this check. The stream_logs tool cannot follow logs without knowing which container to stream from.
Solutions
- Include a non-empty container_id in the stream_logs arguments
- Resolve a container name to an id first via the container listing tool, then pass the id
- If unsure which container, list containers first and pick the exact id
Example fix
// before
parseStreamArgs(`{"level": "error"}`)
// after
parseStreamArgs(`{"container_id": "a1b2c3", "level": "error"}`) Defensive patterns
Strategy: validation
Validate before calling
var probe struct{ ContainerID string `json:"container_id"` }
if err := json.Unmarshal([]byte(argsJSON), &probe); err != nil || probe.ContainerID == "" {
// reject early: container_id missing
} Try / catch
if err != nil && strings.Contains(err.Error(), "container_id is required") {
// fetch container id from listing tool, then retry
} Prevention
- Always include container_id in stream_logs arguments
- Resolve container names to ids before invoking the stream tool
- Validate required fields in tool schemas client-side
When it happens
Trigger: executeStreamLogs calls parseStreamArgs with a JSON body that unmarshals fine but leaves args.ContainerID == "" (field absent, empty string, or null).
Common situations: LLM tool call omitting container_id because it only knew the container name; client sending {"container_id": ""}; host-only filtering attempted against a per-container stream endpoint.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- container_id is required
- unknown action
- invalid start time format (expected RFC3339)
- invalid end time format (expected RFC3339)
- invalid regex pattern
AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07).
Data as JSON: /api/errors/c1dabaca626d10b3.
Report an issue: GitHub.
Appendix: source
Thrown at internal/cloud/tools_stream.go:25
"regexp"
"strings"
"time"
"github.com/amir20/dozzle/internal/container"
pb "github.com/amir20/dozzle/proto/cloud"
"github.com/rs/zerolog/log"
)
// streamSender is a function that sends a ToolResponse to the cloud.
type streamSender func(resp *pb.ToolResponse) error
func parseStreamArgs(argsJSON string) (*fetchLogsArgs, *regexp.Regexp, error) {
var args fetchLogsArgs
if err := json.Unmarshal([]byte(argsJSON), &args); err != nil {
return nil, nil, fmt.Errorf("failed to parse arguments: %w", err)
}
if args.ContainerID == "" {
return nil, nil, fmt.Errorf("container_id is required")
}
var re *regexp.Regexp
if args.Regex != "" {
var err error
re, err = regexp.Compile(args.Regex)
if err != nil {
return nil, nil, fmt.Errorf("invalid regex pattern: %w", err)
}
}
return &args, re, nil
}
func matchesFilters(event *container.LogEvent, args *fetchLogsArgs, re *regexp.Regexp) (string, bool) {
if args.Level != "" && !strings.EqualFold(event.Level, args.Level) {
return "", false
}
View on GitHub (pinned to d9463cbe21)