{"record":{"id":"d39acf710735d03d","repo":"GoogleContainerTools/skaffold","slug":"statuscheck-run-container-err","errorCode":"STATUSCHECK_RUN_CONTAINER_ERR","errorMessage":"container %s in error: %s","messagePattern":"container (.+?) in error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/diag/validator/validator.go","lineNumber":375,"sourceCode":"func extractErrorMessageFromWaitingContainerStatus(po *v1.Pod, c v1.ContainerStatus) (proto.StatusCode, []string, error) {\n\t// Extract meaning full error out of container statuses.\n\tswitch c.State.Waiting.Reason {\n\tcase podInitializing:\n\t\t// container is waiting to run. This could be because one of the init containers is\n\t\t// still not completed\n\t\treturn proto.StatusCode_STATUSCHECK_POD_INITIALIZING, nil, nil\n\tcase containerCreating:\n\t\treturn proto.StatusCode_STATUSCHECK_CONTAINER_CREATING, nil, fmt.Errorf(\"creating container %s\", c.Name)\n\tcase crashLoopBackOff:\n\t\t// TODO, in case of container restarting, return the original failure reason due to which container failed.\n\t\tsc, l := getPodLogs(po, c.Name, proto.StatusCode_STATUSCHECK_CONTAINER_RESTARTING)\n\t\treturn sc, l, fmt.Errorf(\"container %s is backing off waiting to restart\", c.Name)\n\tcase ImagePullErr, ImagePullBackOff, ErrImagePullBackOff:\n\t\treturn proto.StatusCode_STATUSCHECK_IMAGE_PULL_ERR, nil, fmt.Errorf(\"container %s is waiting to start: %s can't be pulled\", c.Name, c.Image)\n\tcase runContainerError:\n\t\tmatch := runContainerRe.FindStringSubmatch(c.State.Waiting.Message)\n\t\tif len(match) != 0 {\n\t\t\treturn proto.StatusCode_STATUSCHECK_RUN_CONTAINER_ERR, nil, fmt.Errorf(\"container %s in error: %s\", c.Name, trimSpace(match[3]))\n\t\t}\n\t}\n\tlog.Entry(context.TODO()).Debugf(\"Unknown waiting reason for container %q: %v\", c.Name, c.State)\n\treturn proto.StatusCode_STATUSCHECK_CONTAINER_WAITING_UNKNOWN, nil, fmt.Errorf(\"container %s in error: %v\", c.Name, c.State.Waiting)\n}\n\nfunc newPodStatus(n string, ns string, p string) *podStatus {\n\treturn &podStatus{\n\t\tname:      n,\n\t\tnamespace: ns,\n\t\tphase:     p,\n\t\tae: proto.ActionableErr{\n\t\t\tErrCode: proto.StatusCode_STATUSCHECK_SUCCESS,\n\t\t},\n\t}\n}\n\nfunc trimSpace(msg string) string {","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/diag/validator/validator.go#L357-L393","documentation":"Skaffold's health-check validator inspects a pod container stuck in a Waiting state and maps known Kubernetes waiting reasons to status codes. When the waiting reason is a run-container error (e.g. OCI runtime failure) and its message matches runContainerRe, it reports STATUSCHECK_RUN_CONTAINER_ERR with the trimmed runtime message. This tells you the container image itself failed to start, not that scheduling or pulling failed.","triggerScenarios":"A container's State.Waiting.Reason is ErrRunContainer / CrashLoopBackOff-style runtime error (from getContainerStatus -> extractErrorMessageFromWaitingContainerStatus during a skaffold verify or apply health check) and State.Waiting.Message matches the runtime error regex.","commonSituations":"Bad entrypoint or command in the image manifest; incompatible architecture image (arm64 vs amd64); missing shared libraries at runtime; seccomp/capability restrictions on the cluster rejecting the container start.","solutions":["Run the image locally (docker run <image>) to reproduce the runtime failure and fix the entrypoint/command or missing runtime dependencies.","Verify the image architecture matches the cluster nodes (docker inspect <image> | grep Architecture; build with --platform if needed).","Check the full State.Waiting.Message via kubectl describe pod <pod> for the underlying OCI runtime error and correct the container spec (env, volumes, securityContext)."],"exampleFix":"// before: bad entrypoint in verify action config\ncmd: [\"/app/start.sh\"] // file not in image -> run-container error\n// after\ncmd: [\"/bin/sh\", \"-c\", \"/app/start.sh\"] // ensure script exists in image and is executable","handlingStrategy":"try-catch","validationCode":"// Pre-check the image runs before submitting to the cluster\ndocker run --rm --entrypoint <image> -- <smoke-cmd> || echo \"image runtime broken\"","typeGuard":null,"tryCatchPattern":"try {\n  await skaffold.verify(...);\n} catch (e) {\n  if (String(e).includes('STATUSCHECK_RUN_CONTAINER_ERR') || /container .* in error/.test(String(e))) {\n    // pull container name from message and inspect locally\n    const name = String(e).match(/container (\\S+) in error/)?.[1];\n    console.error(`Runtime failure in ${name}; test the image with docker run`);\n  }\n  throw e;\n}","preventionTips":["Smoke-test images locally with docker run before cluster health checks","Pin --platform to match cluster node architecture","Keep entrypoint scripts executable and referenced paths present in the image"],"tags":["kubernetes","container-runtime","skaffold","health-check"],"backgroundTag":"container-failed-to-start","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"}