amir20/dozzle · error
container not found
Error message
container not found: %w
What it means
After parsing arguments and resolving the action, executeContainerAction resolves the target via HostService.FindContainer; any failure is wrapped as 'container not found: %w'. The container or host could not be located with the given IDs and label filters, so the action is aborted.
Solutions
- List current containers via the ListContainers/FindContainers tool and use a fresh ID
- Verify host_id matches a connected host returned by ListHosts
- Check configured label filters (deps.Labels) are not excluding the container
- If the container was recreated, use the new container ID or its name-based lookup
Example fix
// before: stale ID from earlier session
{"container_id": "e9034...", "host_id": "old-host"}
// after: resolve first, then act
// hits := ListContainers(); use hits[0].ContainerId Defensive patterns
Strategy: validation
Validate before calling
// resolve the container first and surface a fresh ID
hosts, _ := deps.HostService.ListHosts()
found := false
for _, h := range hosts {
if h.ID == args.HostID { found = true }
}
if !found { return fmt.Errorf("unknown host_id %q", args.HostID) } Try / catch
cs, err := deps.HostService.FindContainer(hostID, containerID, labels)
if err != nil {
return toolErrorResponse("container not found; call ListContainers for valid IDs")
} Prevention
- Always resolve container IDs via ListContainers/FindContainers right before acting
- Re-resolve IDs after container restarts or recreations
- Check label filters are not hiding the target container
- Confirm the host_id exists and its agent is connected
When it happens
Trigger: Calling an action tool with a container_id or host_id that does not exist, an ID belonging to another host, or a container excluded by the configured label filters (deps.Labels).
Common situations: LLM hallucinating container IDs from stale context; container removed/recreated so its ID changed; agent host offline; containers filtered out by dev.dozzle.* label restrictions.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- action failed
- container actions are not enabled
- unknown tool
- failed to parse arguments
- cloud search failed
AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07).
Data as JSON: /api/errors/ce35211af25dcecd.
Report an issue: GitHub.
Appendix: source
Thrown at internal/cloud/tools_actions.go:35
func executeContainerAction(ctx context.Context, name string, argsJSON string, deps ToolDeps) (*pb.CallToolResponse, error) {
var args containerActionArgs
if err := json.Unmarshal([]byte(argsJSON), &args); err != nil {
return nil, fmt.Errorf("failed to parse arguments: %w", err)
}
action, err := resolveAction(name)
if err != nil {
return nil, err
}
hostID, containerID, err := resolveContainerRef(args.ContainerID, args.Host, deps)
if err != nil {
return nil, err
}
cs, err := deps.HostService.FindContainer(hostID, containerID, deps.Labels)
if err != nil {
return nil, fmt.Errorf("container not found: %w", err)
}
if err := cs.Action(ctx, action); err != nil {
return nil, fmt.Errorf("action failed: %w", err)
}
message := fmt.Sprintf("Successfully %s container %s.", pastTense(action), cs.Container.Name)
return &pb.CallToolResponse{
Success: true,
Result: &pb.CallToolResponse_Action{Action: &pb.ActionResult{
Success: true,
ContainerId: cs.Container.ID,
Action: string(action),
Message: message,
}},
}, nil
}View on GitHub (pinned to d9463cbe21)