{"record":{"id":"0f7739e7fc1f151b","repo":"quarkusio/quarkus","slug":"cannot-determine-image-path-image-path","errorCode":null,"errorMessage":"Cannot determine image path (image path)","messagePattern":"Cannot determine image path \\(image path\\)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/packaging/jlink/launcher/src/main/java/io/quarkus/jlink/launcher/JLinkAppLauncher.java","lineNumber":48,"sourceCode":"        ModuleLayer myLayer = myModule.getLayer();\n        if (myLayer == null) {\n            throw new IllegalStateException(\"Module of jlink image launcher is not in a module layer\");\n        }\n\n        @SuppressWarnings(\"resource\")\n        ModuleLoader base = ModuleLoader.forLayer(\"base\", myLayer);\n\n        // try to ascertain our own path\n        String cmd = ProcessHandle.current().info().command()\n                .orElseThrow(() -> new IllegalStateException(\"Cannot determine image path (ProcessHandle)\"));\n        Path cmdPath = Path.of(cmd);\n        Path binPath = cmdPath.getParent();\n        if (binPath == null || !binPath.getFileName().toString().equals(\"bin\")) {\n            throw new IllegalStateException(\"Cannot determine image path (bin path)\");\n        }\n        Path imagePath = binPath.getParent();\n        if (imagePath == null) {\n            throw new IllegalStateException(\"Cannot determine image path (image path)\");\n        }\n\n        Path libPath = imagePath.resolve(\"lib\").resolve(\"quarkus\");\n\n        // create a layer for our dynamic modules\n        ModuleLoader dyn = new ModuleLoader(\"dyn\", ModuleFinder.fromFileSystem(List.of(libPath))) {\n            public LoadedModule loadModule(final String moduleName) {\n                LoadedModule found = base.loadModule(moduleName);\n                if (found == null) {\n                    found = super.loadModule(moduleName);\n                }\n                return found;\n            }\n        };\n\n        // load the application\n        LoadedModule loadedModule = dyn.loadModule(appModule);\n        if (loadedModule == null) {","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/packaging/jlink/launcher/src/main/java/io/quarkus/jlink/launcher/JLinkAppLauncher.java#L30-L66","documentation":"Immediately after resolving the bin directory, the launcher takes its parent as the image root. If binPath.getParent() returns null (bin is a filesystem root), the image path cannot be determined and the launcher aborts. A sibling error 'Cannot determine image path (bin path)' covers the case where the parent isn't named 'bin'.","triggerScenarios":"The launcher executable sits directly at a filesystem root (its bin directory has no parent) — an essentially impossible layout for a real jlink image.","commonSituations":"Highly contrived setups where the executable is mounted/chrooted at /bin of a root namespace or a sandbox flattens the image layout to the root.","solutions":["Restore the standard image layout so the launcher lives at <image>/bin/<name> with a non-root parent","Run from an installed image directory, not a chroot/mount where bin is the filesystem root","Regenerate the jlink image with the Quarkus jlink packaging extension"],"exampleFix":"null","handlingStrategy":"validation","validationCode":"Path binPath = Path.of(\n        ProcessHandle.current().info().command().orElseThrow()).getParent();\nif (binPath == null || binPath.getParent() == null) {\n    throw new IllegalStateException(\"bin directory has no parent; invalid image layout\");\n}","typeGuard":"boolean hasImageRoot(Path binDir) {\n    return binDir.getParent() != null;\n}","tryCatchPattern":"try {\n    JLinkAppLauncher.run(appModule, args);\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"image path\")) {\n        throw new IllegalStateException(\"Image layout invalid; regenerate the image\", e);\n    }\n    throw e;\n}","preventionTips":["Keep the executable nested at least one level below the filesystem root","Regenerate images with the Quarkus jlink extension rather than hand-editing layouts","Avoid chroot/mount setups that place bin at the root"],"tags":["jlink","launcher","path"],"backgroundTag":"image-layout-violation","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"}