{"record":{"id":"24d1dc9b16725490","repo":"amir20/dozzle","slug":"action-failed-w","errorCode":null,"errorMessage":"action failed: %w","messagePattern":"action failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/tools_actions.go","lineNumber":39,"sourceCode":"\t}\n\n\taction, err := resolveAction(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thostID, containerID, err := resolveContainerRef(args.ContainerID, args.Host, deps)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcs, err := deps.HostService.FindContainer(hostID, containerID, deps.Labels)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"container not found: %w\", err)\n\t}\n\n\tif err := cs.Action(ctx, action); err != nil {\n\t\treturn nil, fmt.Errorf(\"action failed: %w\", err)\n\t}\n\n\tmessage := fmt.Sprintf(\"Successfully %s container %s.\", pastTense(action), cs.Container.Name)\n\n\treturn &pb.CallToolResponse{\n\t\tSuccess: true,\n\t\tResult: &pb.CallToolResponse_Action{Action: &pb.ActionResult{\n\t\t\tSuccess:     true,\n\t\t\tContainerId: cs.Container.ID,\n\t\t\tAction:      string(action),\n\t\t\tMessage:     message,\n\t\t}},\n\t}, nil\n}\n\nfunc executeUpdateContainer(ctx context.Context, argsJSON string, deps ToolDeps) (*pb.CallToolResponse, error) {\n\tvar args containerActionArgs\n\tif err := json.Unmarshal([]byte(argsJSON), &args); err != nil {","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/amir20/dozzle/blob/d9463cbe21874e44ab79db6fa63e746ca7d22928/internal/cloud/tools_actions.go#L21-L57","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the wrapped engine error for the specific cause (state conflict, permissions, network)","Verify the container's current state supports the requested action before retrying","Check Docker daemon permissions of the Dozzle agent/container (socket access)","Retry transient failures with backoff; confirm the host connection is healthy"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := cs.Action(ctx, action); err != nil {\n    if ctx.Err() != nil {\n        return toolErrorResponse(\"action canceled: timeout\")\n    }\n    return toolErrorResponse(fmt.Sprintf(\"%s failed: %v\", action, err))\n}","preventionTips":["Check the container's current state before issuing start/stop/restart","Give Dozzle proper Docker socket permissions","Use short action timeouts and surface engine errors verbatim","Retry only idempotent actions (restart) with backoff"],"tags":["cloud","tools","docker","containers","actions"],"backgroundTag":"invalid-state-transition","analyzedSha":"d9463cbe21874e44ab79db6fa63e746ca7d22928","analyzedAt":"2026-09-07T10:08:55.855Z","contentChangedAt":"2026-09-07T10:08:55.855Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}