{"record":{"id":"d42466efa839e315","repo":"nektos/act","slug":"failed-to-list-containers-w","errorCode":null,"errorMessage":"failed to list containers: %w","messagePattern":"failed to list containers: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/container/docker_run.go","lineNumber":316,"sourceCode":"\t\t\tcr.cli = nil\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to close client: %w\", err)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}\n\nfunc (cr *containerReference) find() common.Executor {\n\treturn func(ctx context.Context) error {\n\t\tif cr.id != \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tresult, err := cr.cli.ContainerList(ctx, client.ContainerListOptions{\n\t\t\tAll: true,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to list containers: %w\", err)\n\t\t}\n\n\t\tfor _, c := range result.Items {\n\t\t\tfor _, name := range c.Names {\n\t\t\t\tif name[1:] == cr.input.Name {\n\t\t\t\t\tcr.id = c.ID\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\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 {","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/container/docker_run.go#L298-L334","documentation":"containerReference.find looks for an existing container with the job's name via ContainerList(All: true) so act can reuse it. If the Docker daemon rejects the list call, 'failed to list containers' wraps the API error.","triggerScenarios":"Docker API ContainerList failing: daemon down or restarting, permission denied (rootless socket vs root daemon, user not in docker group), or a proxy/remote endpoint that breaks the API mid-run.","commonSituations":"Docker service restarting during a long act run, disk pressure causing the daemon to be unresponsive, CI environments where the docker socket is mounted read-only, or interrupted prior runs leaving act's name-matching unable to proceed.","solutions":["docker ps -a to confirm the daemon answers and you have permission","Add yourself to the docker group or fix socket permissions for rootless setups","Restart the Docker daemon if it is wedged; prune stale containers (docker container prune)","Re-run the workflow after the daemon is healthy"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# shell pre-flight\ndocker ps >/dev/null || { echo \"daemon not answering\" >&2; exit 1; }\n[ -S /var/run/docker.sock ] && [ -r /var/run/docker.sock ] || echo \"check socket perms/group\"","typeGuard":null,"tryCatchPattern":"// Go: retry list once — transient daemon restarts are common\nvar items []container.Summary\nvar err error\nfor i := 0; i < 2; i++ {\n    res, e := cli.ContainerList(ctx, client.ContainerListOptions{All: true})\n    if e == nil { items = res.Items; break }\n    err = e\n    time.Sleep(time.Second)\n}","preventionTips":["Run docker ps before long jobs to confirm availability","For rootless/socket setups, ensure the invoking user has access","Prune leftover act- containers between runs"],"tags":["docker","container-list","daemon-connection","permissions"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}