amir20/dozzle · error

action failed

Error message

action failed: %w

What it means

executeContainerAction calls cs.Action(ctx, action) to perform start/stop/restart on the container and wraps any failure as 'action failed: %w'. The container was found but the Docker/engine operation itself failed. The wrapped error carries the engine-level reason.

Solutions

  1. Read the wrapped engine error for the specific cause (state conflict, permissions, network)
  2. Verify the container's current state supports the requested action before retrying
  3. Check Docker daemon permissions of the Dozzle agent/container (socket access)
  4. Retry transient failures with backoff; confirm the host connection is healthy
Defensive patterns

Strategy: try-catch

Try / catch

if err := cs.Action(ctx, action); err != nil {
    if ctx.Err() != nil {
        return toolErrorResponse("action canceled: timeout")
    }
    return toolErrorResponse(fmt.Sprintf("%s failed: %v", action, err))
}

Prevention

When it happens

Trigger: The resolved action returns an error from the Docker API: container already in the target state, engine refuses the transition, context canceled, or the container client's underlying transport fails.

Common situations: Restarting a container that is stopped with restart policy disabled and fails to start; stopping an already-stopped container if the engine rejects it; permission issues against the Docker socket; host/agent connection dropped mid-action.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

Thrown at internal/cloud/tools_actions.go:39

	}

	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
}

func executeUpdateContainer(ctx context.Context, argsJSON string, deps ToolDeps) (*pb.CallToolResponse, error) {
	var args containerActionArgs
	if err := json.Unmarshal([]byte(argsJSON), &args); err != nil {

View on GitHub (pinned to d9463cbe21)