{"record":{"id":"22fc2c7f5301fe5d","repo":"quarkusio/quarkus","slug":"the-unnamed-module-cannot-be-opened-to-other-modul","errorCode":null,"errorMessage":"The unnamed module cannot be opened to other modules","messagePattern":"The unnamed module cannot be opened to other modules","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/builditem/ModuleOpenBuildItem.java","lineNumber":65,"sourceCode":"     * in preparation for more extensive modularization.\n     * If the library to which you're opening to isn't on the module path yet at this point, it\n     * should still be beneficial to refer to it by the expected module name.\n     * 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    }","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/builditem/ModuleOpenBuildItem.java#L47-L83","documentation":"ModuleOpenBuildItem declares JPMS module opens made by the Quarkus build. The constructor rejects ALL_UNNAMED as the module being opened to, because the unnamed module (the classpath) has no packages to open and JPMS forbids opening it; such a call is always a caller mistake.","triggerScenarios":"Calling new ModuleOpenBuildItem(\"ALL_UNNAMED\", ...) or passing Module.OPEN_ALL_UNNAMED-style constant as openedModuleName during build-step processing.","commonSituations":"Writing a custom build step that mirrors java.lang.Module.addOpens and accidentally using the ALL_UNNAMED constant for the target module instead of the opening module; porting code that opened the classpath to reflection.","solutions":["Pass a real named module name (the module containing the packages) as openedModuleName instead of ALL_UNNAMED","If you intend to open to everything, omit openedModuleName / use the ALL_UNNAMED semantics on the opening side per the Javadocs","Check the Javadoc of ModuleOpenBuildItem for correct argument order and semantics"],"exampleFix":"// before\nnew ModuleOpenBuildItem(\"ALL_UNNAMED\", \"com.example.pkg\");\n// after\nnew ModuleOpenBuildItem(\"com.example.module\", \"com.example.pkg\");","handlingStrategy":"validation","validationCode":"if (\"ALL_UNNAMED\".equals(openedModuleName)) throw new IllegalArgumentException(\"openedModuleName must be a named module\");","typeGuard":"boolean isValidModuleName(String n) { return n != null && !n.isBlank() && !\"ALL_UNNAMED\".equals(n); }","tryCatchPattern":null,"preventionTips":["Never pass ALL_UNNAMED as the opened module; only real module names","Read the ModuleOpenBuildItem Javadocs before use","Keep argument order (opening module, packages, opened module) clear in call sites"],"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-14T00:17:10.932Z"}