{"record":{"id":"f427a74747a52542","repo":"GoogleContainerTools/skaffold","slug":"q-running-container-image-q-errored-during-run-w-f427a7","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":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/verify/docker/verify.go","lineNumber":280,"sourceCode":"\tv.TrackContainerFromBuild(graph.Artifact{\n\t\tImageName: opts.VerifyTestName,\n\t\tTag:       opts.VerifyTestName,\n\t}, tracker.Container{Name: containerName, ID: id})\n\n\tvar timeoutDuration *time.Duration = nil\n\tif tc.Config.Timeout != nil {\n\t\ttimeoutDuration = util.Ptr(time.Second * time.Duration(*tc.Config.Timeout))\n\t}\n\n\tvar containerErr error\n\tselect {\n\tcase err := <-errCh:\n\t\tif err != nil {\n\t\t\tcontainerErr = err\n\t\t}\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\", opts.VerifyTestName, opts.ContainerConfig.Image, status.StatusCode))\n\t\t}\n\tcase <-v.timeout(timeoutDuration):\n\t\t// verify test timed out\n\t\tcontainerErr = errors.New(fmt.Sprintf(\"%q running container image %q timed out after : %v\", opts.VerifyTestName, opts.ContainerConfig.Image, *timeoutDuration))\n\t\tv.client.Stop(ctx, id, util.Ptr(time.Second*0))\n\t\terr := v.client.Remove(ctx, id)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(containerErr, err.Error())\n\t\t}\n\t}\n\n\tif containerErr != nil {\n\t\teventV2.VerifyFailed(tc.Name, containerErr)\n\t\treturn errors.Wrap(containerErr, \"verify test failed\")\n\t}\n\n\teventV2.VerifySucceeded(opts.VerifyTestName)\n\treturn nil","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/verify/docker/verify.go#L262-L298","documentation":"In the Docker verify runner (pkg/skaffold/verify/docker/verify.go:280), createAndRunContainer runs a verify test inside a Docker container and waits on a status channel. When the container exits with a non-zero status code, the runner wraps the failure into this error naming the verify test and container image. It is the Docker-verify equivalent of a failing test process exit code.","triggerScenarios":"A `skaffold verify` run using the docker verifier where the container started from opts.ContainerConfig.Image finishes with status.StatusCode != 0; errCh delivered no error, so the failure came from the container's own exit code.","commonSituations":"The containerized test binary exits non-zero (failing tests, assertion errors); wrong image tag pulling a broken build; missing env vars/files inside the container causing the entrypoint to crash; entrypoint script using `exit 1` on validation failure.","solutions":["Read the container logs (docker logs or rerun with verbose output) to see the actual failure printed by the test inside the container","Fix the failing test or application code that produced the non-zero exit code","Verify the image referenced by the verify test config is the freshly built, correct image","Check the container's env/args/mounts in the skaffold.yaml verify config so the test has everything it needs"],"exampleFix":"// before: container image is stale/broken\n// skaffold.yaml verify: image: my-app-test:old\n// after\n// skaffold.yaml verify: image: my-app-test:latest  # rebuilt image with fixed tests","handlingStrategy":"validation","validationCode":"// Before running `skaffold verify`, confirm the image exists locally\nif !docker.ImageExists(opts.ContainerConfig.Image) {\n    return fmt.Errorf(\"verify image %q not built/present\", opts.ContainerConfig.Image)\n}","typeGuard":"func isContainerExitErr(err error) (int, bool) {\n    m := regexp.MustCompile(`status code: (\\d+)`).FindStringSubmatch(err.Error())\n    if m == nil {\n        return 0, false\n    }\n    code, _ := strconv.Atoi(m[1])\n    return code, true\n}","tryCatchPattern":"if err := skaffold.Verify(ctx, opts); err != nil {\n    if code, ok := isContainerExitErr(err); ok {\n        log.Printf(\"verify test failed with exit code %d; see container logs\", code)\n    } else {\n        return err\n    }\n}","preventionTips":["Run the test image manually with `docker run <image>` before wiring it into verify","Keep verify images rebuilt as part of the pipeline so tests are current","Provide all env vars, args, and mounts the container entrypoint expects","Make test entrypoints print clear diagnostics before exiting non-zero"],"tags":["docker","verify","container","exit-code"],"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"}