{"record":{"id":"41e6f35c4a59337e","repo":"testcontainers/testcontainers-java","slug":"wait-strategy-failed-container-crashed-error","errorCode":null,"errorMessage":"Wait strategy failed. Container crashed: ${error}","messagePattern":"Wait strategy failed\\. Container crashed: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/testcontainers/containers/GenericContainer.java","lineNumber":515,"sourceCode":"                if (inspectContainerResponse == null) {\n                    throw new IllegalStateException(\"Wait strategy failed. Container is removed\", e);\n                }\n\n                InspectContainerResponse.ContainerState state = inspectContainerResponse.getState();\n                if (Boolean.TRUE.equals(state.getDead())) {\n                    throw new IllegalStateException(\"Wait strategy failed. Container is dead\", e);\n                }\n\n                if (Boolean.TRUE.equals(state.getOOMKilled())) {\n                    throw new IllegalStateException(\n                        \"Wait strategy failed. Container crashed with out-of-memory (OOMKilled)\",\n                        e\n                    );\n                }\n\n                String error = state.getError();\n                if (!StringUtils.isBlank(error)) {\n                    throw new IllegalStateException(\"Wait strategy failed. Container crashed: \" + error, e);\n                }\n\n                if (!Boolean.TRUE.equals(state.getRunning())) {\n                    throw new IllegalStateException(\n                        \"Wait strategy failed. Container exited with code \" + state.getExitCode(),\n                        e\n                    );\n                }\n\n                throw e;\n            }\n\n            logger().info(\"Container {} started in {}\", dockerImageName, Duration.between(startedAt, Instant.now()));\n            containerIsStarted(containerInfo, reused);\n        } catch (Exception e) {\n            if (e instanceof UndeclaredThrowableException && e.getCause() instanceof Exception) {\n                e = (Exception) e.getCause();\n            }","sourceCodeStart":497,"sourceCodeEnd":533,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/core/src/main/java/org/testcontainers/containers/GenericContainer.java#L497-L533","documentation":"When the wait strategy fails, tryStart reads the container's state.error field (Docker's error string for the container, e.g. from a failed entrypoint exec) and, if non-blank, throws this IllegalStateException including that error text. It surfaces Docker's own description of the crash as the message.","triggerScenarios":"Docker records an error on the container state — commonly 'OCI runtime create failed ... no such file or directory' for a missing binary/script in the command, or exec format errors for wrong-architecture images — while the wait strategy was pending.","commonSituations":"withCommand() pointing at a file that doesn't exist in the image; pulling an arm64 image on x86 (exec format error); bad entrypoint permissions; malformed volume mounts breaking the runtime.","solutions":["Read the Docker error embedded in the message — it names the missing binary or runtime problem.","Fix the command/entrypoint path so it exists in the image, or add the file.","Use an image matching the host architecture (or enable emulation) to avoid 'exec format error'.","Check file permissions on any script used as entrypoint (chmod +x, correct shebang)."],"exampleFix":"// before\nnew GenericContainer<>(\"alpine\").withCommand(\"/app/start.sh\"); // OCI error: no such file\n// after\nnew GenericContainer<>(\"alpine\").withCommand(\"sh\", \"/app/start.sh\"); // or add the script to the image","handlingStrategy":"validation","validationCode":"// verify the entrypoint exists and is executable in the image:\n// docker run --rm --entrypoint ls <image> -l /path/to/cmd","typeGuard":"null","tryCatchPattern":"try {\n    container.start();\n} catch (ContainerLaunchException e) {\n    // message contains Docker's state.error (e.g. 'OCI runtime create failed') — read it\n    throw e;\n}","preventionTips":["Ensure commands/entrypoints exist in the image and are chmod +x with a valid shebang.","Match image architecture to host (or configure binfmt emulation).","Test the image's default CMD manually before overriding it."],"tags":["docker","wait-strategy","oci-runtime"],"backgroundTag":"container-wait-strategy-failed","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}