amir20/dozzle · error

container not found

Error message

container not found: %w

What it means

executeInspectContainer resolves the container reference and calls deps.HostService.FindContainer. When no matching container exists on the resolved host, the underlying error is wrapped as "container not found" and surfaced to the cloud tool caller.

Solutions

  1. Re-resolve with find_containers to obtain the current container ID and host before inspecting.
  2. Verify the host argument; in multi-host deployments the container only lives on one node.
  3. Confirm with `docker ps` that the container exists and is running on the expected Docker host.

Example fix

// before: inspecting by removed id
inspect_container({"containerId":"deadbeef"})
// after
find_containers({"name":"api"}) -> inspect_container({"containerId": <fresh id>, "host": <hostId>})
Defensive patterns

Strategy: validation

Validate before calling

const list = await callTool("find_containers", JSON.stringify({ name: targetName }));
const match = list.containers?.find(c => c.name === targetName);
if (!match) throw new Error(`no container named '${targetName}'; nothing to inspect`);

Type guard

function isInspectable(c) {
  return typeof c?.id === "string" && c.id.length > 0 && typeof c?.host === "string";
}

Try / catch

try {
  return await callTool("inspect_container", JSON.stringify({ containerId: match.id, host: match.host }));
} catch (e) {
  if (String(e).includes("container not found")) {
    // id went stale; re-run find_containers and retry once
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling inspect_container with a containerId that is unknown, removed, belongs to another host, or an ambiguous name that does not resolve on the given host.

Common situations: Inspecting a container right after it was recreated (ID changed); multi-host setups where the host argument points at the wrong node; name-based lookup when dev.dozzle.name labels changed.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07). Data as JSON: /api/errors/dd3fcb0d529ac60a. Report an issue: GitHub.

Appendix: source

Thrown at internal/cloud/tools_containers.go:182

}

func executeInspectContainer(argsJSON string, deps ToolDeps) (*pb.CallToolResponse, error) {
	var args inspectContainerArgs
	if err := json.Unmarshal([]byte(argsJSON), &args); err != nil {
		return nil, fmt.Errorf("failed to parse arguments: %w", err)
	}
	// Read-only: resolve an ambiguous name in one shot rather than erroring and
	// forcing a find_containers round-trip. The note is discarded here because
	// inspect already returns the concrete id/name/state, which is itself the
	// disambiguation — no need to mangle those structured fields with prose.
	hostID, containerID, _, err := resolveContainerRefRead(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)
	}

	c := cs.Container
	return &pb.CallToolResponse{
		Success: true,
		Result: &pb.CallToolResponse_InspectContainer{InspectContainer: &pb.InspectContainerResult{
			Id:            c.ID,
			Name:          c.Name,
			Image:         c.Image,
			Command:       c.Command,
			Created:       c.Created.UTC().Format(time.RFC3339),
			StartedAt:     c.StartedAt.UTC().Format(time.RFC3339),
			FinishedAt:    formatTimeOrEmpty(c.FinishedAt),
			State:         c.State,
			Health:        c.Health,
			HostName:      resolveHostName(c.Host, buildHostNameMap(deps.HostService)),
			HostId:        c.Host,
			Labels:        c.Labels,

View on GitHub (pinned to d9463cbe21)