{"record":{"id":"bbb5107df66a1478","repo":"JetBrains/intellij-community","slug":"idea-cannot-generate-javadoc-as-module-source-path","errorCode":null,"errorMessage":"IDEA cannot generate Javadoc as module-source-path cannot be evaluated","messagePattern":"IDEA cannot generate Javadoc as module-source-path cannot be evaluated","errorType":"exception","errorClass":"CantRunException","httpStatus":null,"severity":"error","filePath":"java/java-impl/src/com/intellij/javadoc/JavadocGeneratorRunProfile.java","lineNumber":298,"sourceCode":"            parameters.add(\"--source\", String.valueOf(languageLevel.feature()));\n            break;\n          }\n        }\n      }\n\n      File argsFile = createTempArgsFile();\n      List<VirtualFile> sourceRoots = findSourceRoots(modules);\n      List<VirtualFile> classRoots = findClassRoots(modules, jdk);\n\n      Charset cs = CharsetToolkit.getPlatformCharset();\n      try (PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(argsFile), cs))) {\n        if (sourceRoots.size() + classRoots.size() > 0) {\n          if (hasJavaModules && JavaSdkUtil.isJdkAtLeast(jdk, JavaSdkVersion.JDK_1_9)) {\n            if (modules.size() > 1) {\n              writer.println(\"--module-source-path\");\n              String moduleSourcePath = computeModuleSourcePath(moduleDescriptors);\n              if (moduleSourcePath == null) {\n                throw new CantRunException(JavaBundle.message(\"javadoc.gen.error.module.source.path.is.not.evaluated\"));\n              }\n              writer.println(StringUtil.wrapWithDoubleQuote(moduleSourcePath));\n            }\n            else if (!sourceRoots.isEmpty()) {\n              String path = sourceRoots.stream().map(MyJavaCommandLineState::localPath).collect(Collectors.joining(File.pathSeparator));\n              writer.println(\"--source-path\");\n              writer.println(StringUtil.wrapWithDoubleQuote(path));\n            }\n\n            if (!classRoots.isEmpty()) {\n              String path = classRoots.stream().map(MyJavaCommandLineState::localPath).collect(Collectors.joining(File.pathSeparator));\n              writer.println(\"--module-path\");\n              writer.println(StringUtil.wrapWithDoubleQuote(path));\n            }\n          }\n          else {\n            // placing source roots on a classpath is perfectly legal and allows generating correct Javadoc\n            // when a module without a module-info.java file depends on another module that has one","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/java-impl/src/com/intellij/javadoc/JavadocGeneratorRunProfile.java#L280-L316","documentation":"With JDK 9+ and more than one module, the runner writes a --module-source-path argument computed by computeModuleSourcePath from the per-module source roots (e.g. 'mod1/*=dir1;mod2/*=dir2' patterns). If that computation returns null — roots cannot be mapped to the expected layout — CantRunException('module-source-path cannot be evaluated') aborts. This is an internal layout-analysis failure: typically a module's content roots do not fit the pattern the algorithm supports.","triggerScenarios":"Multi-module JPMS javadoc generation where a module's source roots are missing, duplicated in an ambiguous way, or arranged (e.g. several production roots per module) such that computeModuleSourcePath cannot construct the module-source-path string.","commonSituations":"Modules whose source root was deleted or is invalid; Gradle/Maven imports producing unusual content-root layouts; modules included via the javadoc scope without any marked source root.","solutions":["Check that every module in the scope has exactly one properly marked production Sources Root containing its module-info.java.","Re-import the project (Gradle/Maven refresh) to regenerate a canonical content-root layout.","If one module has an exotic layout, generate javadoc module-by-module with single-module scopes to isolate the offender."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Each module must have exactly one marked production source root containing module-info.java\nfor (Module m : modules) {\n  List<VirtualFile> roots = OrderEnumerator.orderEntries(m).getSourcePathsList... // or ModuleRootManager.getSourceRoots()\n  if (roots.stream().noneMatch(r -> r.findChild(PsiJavaModule.MODULE_INFO_FILE) != null)) { notify(\"Module \" + m.getName() + \" layout prevents module-source-path\"); return; }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep one canonical production source root per JPMS module","Re-import the project after structural build-config changes"],"tags":["javadoc","jpms","module-info","source-roots","ide"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}