{"record":{"id":"e3d888db685d2393","repo":"nektos/act","slug":"failed-to-remove-container-w","errorCode":null,"errorMessage":"failed to remove container: %w","messagePattern":"failed to remove container: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/container/docker_run.go","lineNumber":345,"sourceCode":"\n\t\tcr.id = \"\"\n\t\treturn nil\n\t}\n}\n\nfunc (cr *containerReference) remove() common.Executor {\n\treturn func(ctx context.Context) error {\n\t\tif cr.id == \"\" {\n\t\t\treturn nil\n\t\t}\n\n\t\tlogger := common.Logger(ctx)\n\t\t_, err := cr.cli.ContainerRemove(ctx, cr.id, client.ContainerRemoveOptions{\n\t\t\tRemoveVolumes: true,\n\t\t\tForce:         true,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Errorf(\"failed to remove container: %w\", err))\n\t\t}\n\n\t\tlogger.Debugf(\"Removed container: %v\", cr.id)\n\t\tcr.id = \"\"\n\t\treturn nil\n\t}\n}\n\nfunc (cr *containerReference) mergeContainerConfigs(ctx context.Context, config *container.Config, hostConfig *container.HostConfig) (*container.Config, *container.HostConfig, error) {\n\tlogger := common.Logger(ctx)\n\tinput := cr.input\n\n\tif input.Options == \"\" {\n\t\treturn config, hostConfig, nil\n\t}\n\n\t// parse configuration from CLI container.options\n\tflags := pflag.NewFlagSet(\"container_flags\", pflag.ContinueOnError)","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/container/docker_run.go#L327-L363","documentation":"containerReference.remove force-removes the job container with RemoveVolumes+Force at cleanup time. The error is deliberately only logged (logger.Error), not returned — cleanup continues and remove returns nil — so this message appears in logs but does not fail the run.","triggerScenarios":"ContainerRemove failing during cleanup: container already gone (race with a previous cleanup), daemon unreachable at teardown, or a container stuck in a state that even Force cannot remove.","commonSituations":"Concurrent act runs or interrupted runs where the container vanished; Docker daemon shut down before the job's finally block ran; overlayfs/network in a bad state on the host.","solutions":["Treat it as a warning: it does not fail the job — check whether the run result matters","docker ps -a | grep act- to find leftovers, then docker rm -f them or docker container prune","If it recurs, investigate daemon health/storage (docker system df, dmesg for overlay errors)","Avoid running multiple act instances that reuse identical container names"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# shell: clean leftovers before a run\ndocker ps -a --format '{{.Names}}' | grep '^act-' | xargs -r docker rm -f","typeGuard":null,"tryCatchPattern":"// Note: remove() already swallows the error internally (logs only, returns nil).\n// If calling the API directly, mirror that:\nif _, err := cli.ContainerRemove(ctx, id, client.ContainerRemoveOptions{RemoveVolumes: true, Force: true}); err != nil {\n    log.Warnf(\"container remove failed (continuing): %w\", err)\n}","preventionTips":["Treat this as log noise unless containers accumulate","Prune stale act- containers periodically","Avoid concurrent act runs sharing container names"],"tags":["docker","container-cleanup","idempotent-removal","logging-only"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}