{"record":{"id":"bb259cb926d724bc","repo":"quarkusio/quarkus","slug":"the-unnamed-module-cannot-be-used-as-an-opening-mo","errorCode":null,"errorMessage":"The unnamed module cannot be used as an opening module identifier: please read the Javadocs for more details","messagePattern":"The unnamed module cannot be used as an opening module identifier: please read the Javadocs for more details","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/builditem/ModuleOpenBuildItem.java","lineNumber":68,"sourceCode":"     * When a module name is specified which couldn't be identified by name, we'll fallback\n     * the opening module name to the unnamed module to allow for an easier transition.\n     *\n     * @param openedModuleName The name of the module which needs to be opened.\n     * @param openingModuleName The name of the module which is being granted access.\n     * @param packageNames The packages which are being opened. At least one must be specified.\n     */\n    public ModuleOpenBuildItem(String openedModuleName, String openingModuleName, String... packageNames) {\n        this.openedModuleName = Assert.checkNotEmptyParam(\"openedModuleName\", openedModuleName);\n        this.openingModuleName = Assert.checkNotEmptyParam(\"openingModuleName\", openingModuleName);\n        this.packageNames = Assert.checkNotEmptyParam(\"packageNames\", Set.of(packageNames));\n        if (packageNames.length == 0) {\n            throw new IllegalArgumentException(\"At least one package name must be specified\");\n        }\n        if (ALL_UNNAMED.equals(openedModuleName)) {\n            throw new IllegalArgumentException(\"The unnamed module cannot be opened to other modules\");\n        }\n        if (ALL_UNNAMED.equals(openingModuleName)) {\n            throw new IllegalArgumentException(\n                    \"The unnamed module cannot be used as an opening module identifier: please read the Javadocs for more details\");\n        }\n    }\n\n    public String openedModuleName() {\n        return openedModuleName;\n    }\n\n    public String openingModuleName() {\n        return openingModuleName;\n    }\n\n    public Set<String> packageNames() {\n        return packageNames;\n    }\n\n    @Override\n    public String toString() {","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/builditem/ModuleOpenBuildItem.java#L50-L86","documentation":"ModuleOpenBuildItem also rejects ALL_UNNAMED as the module doing the opening. The opening module must be a named module because Quarkus records opens on behalf of named modules in the resulting image; the unnamed module cannot be an identifier here.","triggerScenarios":"Calling new ModuleOpenBuildItem(packageNames..., openedModuleName) where the openingModuleName argument is \"ALL_UNNAMED\".","commonSituations":"Mixing up the parameter order so the ALL_UNNAMED constant intended for the 'opened to' side lands in the opening-module slot; copy-paste from reflection code using \"ALL_UNNAMED\".","solutions":["Swap/reorder the arguments so ALL_UNNAMED (if needed at all) is the openedModuleName, not the openingModuleName","Use the concrete name of the module performing the open","Read the ModuleOpenBuildItem Javadocs as the message suggests"],"exampleFix":"// before\nnew ModuleOpenBuildItem(\"ALL_UNNAMED\", \"com.example.pkg\", \"java.base\");\n// after\nnew ModuleOpenBuildItem(\"com.example.module\", \"com.example.pkg\");","handlingStrategy":"validation","validationCode":"if (\"ALL_UNNAMED\".equals(openingModuleName)) throw new IllegalArgumentException(\"openingModuleName must be a named module\");","typeGuard":"boolean isNamedModule(String n) { return n != null && !n.isBlank() && !\"ALL_UNNAMED\".equals(n); }","tryCatchPattern":null,"preventionTips":["Double-check parameter order — ALL_UNNAMED confusion between opening/opened is the common mistake","Consult the Javadocs as the error message suggests","Use named constants with distinct names to avoid swapping the two module arguments"],"tags":["jpms","build-time","illegal-argument"],"backgroundTag":"invalid-module-open","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}