{"record":{"id":"96d0062357d22f58","repo":"quarkusio/quarkus","slug":"cannot-get-an-executable-name-when-no-container-ru","errorCode":null,"errorMessage":"Cannot get an executable name when no container runtime is available","messagePattern":"Cannot get an executable name when no container runtime is available","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/util/ContainerRuntimeUtil.java","lineNumber":274,"sourceCode":"        DOCKER_ROOTLESS(\"docker\", true),\n        WSL(\"docker\", false),\n        WSL_ROOTLESS(\"docker\", false),\n        PODMAN(\"podman\", false),\n        PODMAN_ROOTLESS(\"podman\", true),\n        UNAVAILABLE(null, false);\n\n        private final String executableName;\n\n        private final boolean rootless;\n\n        ContainerRuntime(String executableName, boolean rootless) {\n            this.executableName = executableName;\n            this.rootless = rootless;\n        }\n\n        public String getExecutableName() {\n            if (this == UNAVAILABLE) {\n                throw new IllegalStateException(\"Cannot get an executable name when no container runtime is available\");\n            }\n\n            return executableName;\n        }\n\n        public boolean isDocker() {\n            return this == DOCKER || this == DOCKER_ROOTLESS || this == WSL || this == WSL_ROOTLESS;\n        }\n\n        public boolean isPodman() {\n            return this == PODMAN || this == PODMAN_ROOTLESS;\n        }\n\n        public boolean isInWindowsWSL() {\n            return this == WSL || this == WSL_ROOTLESS;\n        }\n\n        public boolean isRootless() {","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/util/ContainerRuntimeUtil.java#L256-L292","documentation":"ContainerRuntime.ContainerRuntime.getExecutableName() returns the CLI executable name for a detected runtime. Calling it on the sentinel UNAVAILABLE enum value throws IllegalStateException(\"Cannot get an executable name when no container runtime is available\") — the sentinel has no associated executable.","triggerScenarios":"Code obtains a ContainerRuntime via detectContainerRuntime(false) (which may return UNAVAILABLE), or from a system property storing UNAVAILABLE, and then calls getExecutableName() on it without checking.","commonSituations":"Extension code or user code doing optional detection then unconditionally reading the executable name; caching a ContainerRuntime from an environment where no CLI was installed and reusing it later.","solutions":["Check runtime != ContainerRuntime.UNAVAILABLE before calling getExecutableName()","When detection is optional, branch on UNAVAILABLE and skip container operations","If detection should always succeed, call detectContainerRuntime() (required=true) so it fails fast with the clearer install-Docker/Podman message"],"exampleFix":"// before\nString exe = ContainerRuntimeUtil.detectContainerRuntime(false).getExecutableName();\n// after\nContainerRuntime rt = ContainerRuntimeUtil.detectContainerRuntime(false);\nString exe = rt == ContainerRuntime.UNAVAILABLE ? null : rt.getExecutableName();","handlingStrategy":"type-guard","validationCode":"static boolean hasRuntime(ContainerRuntime rt) {\n    return rt != ContainerRuntime.UNAVAILABLE;\n}\n","typeGuard":"if (rt != ContainerRuntime.UNAVAILABLE) {\n    String exe = rt.getExecutableName();\n}\n","tryCatchPattern":"try {\n    String exe = rt.getExecutableName();\n} catch (IllegalStateException e) {\n    // rt was UNAVAILABLE — handle the no-container case\n    return null;\n}\n","preventionTips":["Always compare against ContainerRuntime.UNAVAILABLE after detectContainerRuntime(required=false)","Use detectContainerRuntime() (required=true) when the executable name is definitely needed, to fail with the clearer message","Never cache ContainerRuntime values across environments without re-checking UNAVAILABLE"],"tags":["docker","podman","container","null-handling"],"backgroundTag":"container-runtime-unavailable","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}