{"record":{"id":"4f40cbf954ff62ef","repo":"apache/maven","slug":"cannot-read-module-information","errorCode":null,"errorMessage":"Cannot read module information.","messagePattern":"Cannot read module information\\.","errorType":"exception","errorClass":"DependencyResolverException","httpStatus":null,"severity":"warning","filePath":"impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyResolverResult.java","lineNumber":484,"sourceCode":"    /**\n     * Returns the module name for the given value of the {@link PathModularization#descriptors} map.\n     */\n    private static String name(final Object value) {\n        if (value instanceof String string) {\n            return string;\n        } else if (value instanceof ModuleDescriptor moduleDescriptor) {\n            return moduleDescriptor.name();\n        } else {\n            return null;\n        }\n    }\n\n    @Override\n    public Optional<String> warningForFilenameBasedAutomodules() {\n        try {\n            return cache.warningForFilenameBasedAutomodules(dispatchedPaths.get(JavaPathType.MODULES));\n        } catch (IOException e) {\n            throw new DependencyResolverException(\"Cannot read module information.\", e);\n        }\n    }\n}\n","sourceCodeStart":466,"sourceCodeEnd":488,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyResolverResult.java#L466-L488","documentation":"DefaultDependencyResolverResult.warningForFilenameBasedAutomodules() inspects the artifacts placed on the Java module path (JavaPathType.MODULES) to warn when a jar is used as an automatic module derived only from its filename. It must open each jar's module descriptor; an IOException during that read is wrapped in DependencyResolverException('Cannot read module information.'). The failure is environmental (unreadable/missing file), not a resolution problem.","triggerScenarios":"Calling result.warningForFilenameBasedAutomodules() after a resolve that produced MODULES-path entries, when one of those jar files was deleted, locked, truncated, or has no read permission at the moment the method opens it.","commonSituations":"Local repository corrupted or pruned concurrently by another build/IDE; antivirus or file locking on Windows; a jar replaced by a directory of the same name in the local repo; long-running processes resolving then reading much later while the cache is cleaned.","solutions":["Identify the failing jar from the IOException in getCause(), then delete that artifact directory from the local repository and re-resolve so it is re-downloaded","Ensure the process has read permissions and no external process locks the local repository files","If the warning is optional for your flow, guard the call and degrade gracefully instead of aborting the build"],"exampleFix":"// before\nOptional<String> warning = result.warningForFilenameBasedAutomodules();\n\n// after\nOptional<String> warning;\ntry {\n    warning = result.warningForFilenameBasedAutomodules();\n} catch (DependencyResolverException e) {\n    log.warn('Could not inspect module info: ' + e.getCause().getMessage());\n    warning = Optional.empty();\n}","handlingStrategy":"try-catch","validationCode":"for (Path p : dispatchedPaths.get(JavaPathType.MODULES)) {\n    if (!Files.isReadable(p)) {\n        throw new IllegalStateException('Module path entry not readable: ' + p);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    Optional<String> warning = result.warningForFilenameBasedAutomodules();\n} catch (DependencyResolverException e) {\n    // optional diagnostic: degrade to empty warning, log the IOException cause\n}","preventionTips":["Consume resolution results promptly; do not hold them across local-repository cleanups","Keep local repository files read-accessible; exclude it from concurrent cleaners","Treat this call as best-effort diagnostics, not a required build step"],"tags":["maven","jpms","module-path","io","local-repository"],"backgroundTag":"module-info-read-failure","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}