{"record":{"id":"9a3a61add7d9001a","repo":"kubernetes/kubernetes","slug":"crashloopbackoff","errorCode":null,"errorMessage":"CrashLoopBackOff","messagePattern":"CrashLoopBackOff","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/kubelet/container/sync_result.go","lineNumber":77,"sourceCode":"\t\t\t\tif !found || backoff.Before(min) {\n\t\t\t\t\tmin = backoff\n\t\t\t\t\tfound = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn min, found\n\tdefault:\n\t\tif e := errors.Unwrap(err); e != nil {\n\t\t\treturn MinBackoffExpiration(e)\n\t\t}\n\t\treturn time.Time{}, false\n\t}\n}\n\n// TODO(random-liu): We need to better organize runtime errors for introspection.\n\n// ErrCrashLoopBackOff returned when a container Terminated and Kubelet is backing off the restart.\nvar ErrCrashLoopBackOff = errors.New(\"CrashLoopBackOff\")\n\nvar (\n\t// ErrContainerNotFound returned when a container in the given pod with the\n\t// given container name was not found, amongst those managed by the kubelet.\n\tErrContainerNotFound = errors.New(\"no matching container\")\n)\n\nvar (\n\t// ErrRunContainer returned when runtime failed to start any of pod's container.\n\tErrRunContainer = errors.New(\"RunContainerError\")\n\t// ErrKillContainer returned when runtime failed to kill any of pod's containers.\n\tErrKillContainer = errors.New(\"KillContainerError\")\n\t// ErrCreatePodSandbox returned when runtime failed to create a sandbox for pod.\n\tErrCreatePodSandbox = errors.New(\"CreatePodSandboxError\")\n\t// ErrConfigPodSandbox returned when runetime failed to get pod sandbox config from pod.\n\tErrConfigPodSandbox = errors.New(\"ConfigPodSandboxError\")\n\t// ErrKillPodSandbox returned when runtime failed to stop pod's sandbox.\n\tErrKillPodSandbox = errors.New(\"KillPodSandboxError\")","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/kubernetes/kubernetes/blob/b882c60b4023bdf09264c2d5d30a2cadebc240fb/pkg/kubelet/container/sync_result.go#L59-L95","documentation":"ErrCrashLoopBackOff (sync_result.go:77) is a sentinel error used in SyncResult.Error to signal that a container has terminated and the kubelet is applying exponential backoff before the next restart attempt. It is not a thrown error in the panic sense; it is attached to a SyncResult.Fail() call to drive the CrashLoopBackOff status and backoff scheduling (MinBackoffExpiration).","triggerScenarios":"During SyncPod, after a container exits (non-zero or repeatedly), the kubelet computes a backoff time and calls SyncResult.Fail(ErrCrashLoopBackOff, msg) to mark the container's state, surfacing as the CrashLoopBackOff pod condition/reason.","commonSituations":"Container crashes on startup: bad command/args, missing dependency, OOM kill, liveness probe failure killing it repeatedly, app panic, wrong image tag, misconfigured env/config, missing Secrets/ConfigMaps. Each restart shortens until backoff grows, producing CrashLoopBackOff.","solutions":["Inspect container logs: kubectl logs <pod> -c <container> and kubectl logs --previous for the crash output.","Check pod describe for OOMKilled/exit codes and events: kubectl describe pod <pod>.","Fix the root cause in the image/config (correct command, env, mounted secrets, resource limits).","If liveness probe is too aggressive, tune initialDelaySeconds/periodSeconds."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Inspect container health before relying on sync results.\nif isContainerCrashing(containerStatus) {\n    // surface logs early to the operator instead of letting backoff grow silently\n}","typeGuard":"func isCrashLoopBackOff(result *container.SyncResult) bool {\n    return result != nil && errors.Is(result.Error, container.ErrCrashLoopBackOff)\n}","tryCatchPattern":"// ErrCrashLoopBackOff is a sentinel on SyncResult, not a thrown error.\n// Read result.Error to detect it and surface logs/backoff to the operator.\nif errors.Is(result.Error, container.ErrCrashLoopBackOff) {\n    klog.InfoS(\"container in CrashLoopBackOff\", \"pod\", klog.KObj(pod), \"backoff\", backoff)\n}","preventionTips":["Watch container logs and exit codes proactively to fix crash root causes.","Tune liveness/readiness probes so they don't kill healthy-but-slow containers.","Verify image tags, commands, env, and mounted Secrets/ConfigMaps before deploy.","Set sane resource requests/limits to avoid OOM-induced crashes."],"tags":["kubernetes","kubelet","pod","crashloopbackoff","container","go"],"analyzedSha":"b882c60b4023bdf09264c2d5d30a2cadebc240fb","analyzedAt":"2026-08-07T04:07:48.144Z","schemaVersion":2},"datasetVersion":"2026-08-07T07:17:06.508Z"}