{"record":{"id":"fe0097eeeb31e9f0","repo":"GoogleContainerTools/skaffold","slug":"q-running-container-image-q-errored-during-run-w","errorCode":null,"errorMessage":"%q running container image %q errored during run with status code: %d","messagePattern":"%q running container image %q errored during run with status code: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/actions/docker/task.go","lineNumber":112,"sourceCode":"\t\treturn err\n\t}\n\n\tstatusCh, errCh, id, err := t.client.Run(ctx, out, *opts)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"creating container in local docker\")\n\t}\n\n\tt.execEnv.TrackContainerFromBuild(graph.Artifact{\n\t\tImageName: t.cfg.Name,\n\t\tTag:       t.cfg.Name,\n\t}, id, cn)\n\n\tvar containerErr error\n\tselect {\n\tcase containerErr = <-errCh:\n\tcase status := <-statusCh:\n\t\tif status.StatusCode != 0 {\n\t\t\tcontainerErr = errors.New(fmt.Sprintf(\"%q running container image %q errored during run with status code: %d\", t.name, opts.ContainerConfig.Image, status.StatusCode))\n\t\t}\n\tcase <-ctx.Done():\n\t\tcontainerErr = ctx.Err()\n\t\tif err := t.client.Stop(context.TODO(), id, util.Ptr(time.Second*0)); err != nil {\n\t\t\tcontainerErr = err\n\t\t}\n\t}\n\n\treturn containerErr\n}\n\nfunc (t Task) Cleanup(ctx context.Context, out io.Writer) error {\n\tid, found := t.execEnv.GetContainerID(t.cfg.Name)\n\tif !found {\n\t\treturn nil\n\t}\n\n\tt.client.Stop(ctx, id, nil)","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/actions/docker/task.go#L94-L130","documentation":"A docker action task (skaffold actions) ran its container and the container exited with a non-zero status code. The task formats this into an error naming the action task, the container image, and the exit code. It surfaces the container's failure rather than Skaffold's own.","triggerScenarios":"execAndLog -> Exec starting a container via the docker client; the container's statusCh reports StatusCode != 0 (the process inside exited with that code). Not triggered by image pull errors or context cancellation (those produce different errors).","commonSituations":"Custom test/verify action scripts failing with exit 1; containers whose entrypoint crashes; images built from failing test suites run as actions.","solutions":["Read the container logs (skaffold streams them) to find the actual failure inside the container","Fix the script/entrypoint in the container image to exit 0 on success","Reproduce locally: `docker run <image>` with the same args to debug the exit code","Check the reported status code — non-zero codes often encode the specific failure mode"],"exampleFix":"// before (Dockerfile/entrypoint)\ncmd\n// after\ncmd || exit 0  # only if the non-zero exit is expected/benign; otherwise fix cmd","handlingStrategy":"try-catch","validationCode":"// pre-flight: run the same image locally and check the exit code\ndocker run --rm <image> <args> || echo \"container will fail with code $?\"","typeGuard":null,"tryCatchPattern":"err := task.Exec(ctx, out)\nif err != nil {\n  var exitErr interface{ ExitCode() int }\n  if errors.As(err, &statusErr) || strings.Contains(err.Error(), \"errored during run with status code\") {\n    log.Errorf(\"action container failed; inspect streamed logs above for the root cause\")\n  }\n  return err\n}","preventionTips":["Ensure action scripts/entrypoints exit 0 on success","Test the container image standalone with docker run before wiring it as an action","Capture and review streamed container logs on failure","Make the container fail fast and loudly with a clear message"],"tags":["docker","container-exit-code","actions","skaffold"],"backgroundTag":"container-exited-nonzero","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}