amir20/dozzle · error
failed to parse arguments
Error message
failed to parse arguments: %w
What it means
executeFindContainers optionally unmarshals its JSON arguments into findContainersArgs. Empty arguments are allowed (lists all containers), but if non-empty arguments are invalid JSON or contain wrong-typed fields, json.Unmarshal fails and the error is wrapped with this message.
Solutions
- Either omit arguments entirely (valid: lists all containers) or send a well-formed JSON object.
- Check the wrapped json error for the offending field/type and correct it.
- Log the exact argsJSON at the caller side to spot encoding problems before dispatch.
Example fix
// before
find_containers("my-app") // not a JSON object
// after
find_containers({"name":"my-app"}) Defensive patterns
Strategy: validation
Validate before calling
// omit args to list everything, or validate before sending
const argsJSON = filter ? JSON.stringify({ name: filter }) : ""; Try / catch
try {
return await callTool("find_containers", argsJSON);
} catch (e) {
if (String(e).includes("failed to parse arguments")) {
// fall back to calling with no arguments to list all containers
return await callTool("find_containers", "");
}
throw e;
} Prevention
- Remember find_containers tolerates empty arguments but not malformed ones.
- Build filter payloads with JSON.stringify.
- Validate the filter object shape against the tool schema.
When it happens
Trigger: Calling the find_containers tool with a filter/name argument that is malformed JSON or of the wrong type (e.g. name as a number, or a JSON array instead of an object).
Common situations: Agent-generated payloads with unescaped characters; passing a JSON-escaped string instead of an object; template interpolation producing invalid JSON.
Understand the failure class
Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- failed to parse arguments
- failed to parse arguments
- failed to parse arguments
- notifications are not configured on this host
- failed to parse arguments
AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07).
Data as JSON: /api/errors/b428cefee26734dc.
Report an issue: GitHub.
Appendix: source
Thrown at internal/cloud/tools_containers.go:49
NCpu: int32(h.NCPU),
MemTotal: h.MemTotal,
DockerVersion: h.DockerVersion,
AgentVersion: h.AgentVersion,
Type: h.Type,
Available: h.Available,
}
}
return &pb.CallToolResponse{
Success: true,
Result: &pb.CallToolResponse_ListHosts{ListHosts: &pb.ListHostsResult{Hosts: result}},
}, nil
}
func executeFindContainers(argsJSON string, deps ToolDeps) (*pb.CallToolResponse, error) {
var args findContainersArgs
if argsJSON != "" {
if err := json.Unmarshal([]byte(argsJSON), &args); err != nil {
return nil, fmt.Errorf("failed to parse arguments: %w", err)
}
}
containers, errs := deps.HostService.ListAllContainers(deps.Labels)
logHostErrors(errs)
hostNames := buildHostNameMap(deps.HostService)
result := make([]*pb.ContainerInfo, 0, len(containers))
for _, c := range containers {
if args.Name != "" && !containsIgnoreCase(c.Name, args.Name) {
continue
}
if args.Image != "" && !containsIgnoreCase(c.Image, args.Image) {
continue
}
if args.State != "" && !strings.EqualFold(c.State, args.State) {
continue
}View on GitHub (pinned to d9463cbe21)