{"record":{"id":"5b62f408f8580776","repo":"quarkusio/quarkus","slug":"failed-to-create-a-url-list-out-of-mvnlib-conte","errorCode":null,"errorMessage":"Failed to create a URL list out of ${mvnLib} content","messagePattern":"Failed to create a URL list out of (.+?) content","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/options/BootstrapMavenOptions.java","lineNumber":95,"sourceCode":"        final Path mvnLib = Paths.get(mavenHome).resolve(\"lib\");\n        if (!Files.exists(mvnLib)) {\n            throw new IllegalStateException(\"Maven lib dir does not exist: \" + mvnLib);\n        }\n        final URL[] urls;\n        try (Stream<Path> files = Files.list(mvnLib)) {\n            final List<URL> list = files.map(p -> {\n                try {\n                    return p.toUri().toURL();\n                } catch (MalformedURLException e) {\n                    throw new IllegalStateException(\"Failed to translate \" + p + \" to URL\", e);\n                }\n            }).collect(Collectors.toCollection(ArrayList::new));\n\n            list.add(getClassOrigin(BootstrapMavenOptions.class).toUri().toURL());\n            urls = list.toArray(new URL[list.size()]);\n\n        } catch (Exception e) {\n            throw new IllegalStateException(\"Failed to create a URL list out of \" + mvnLib + \" content\", e);\n        }\n        final ClassLoader originalCl = Thread.currentThread().getContextClassLoader();\n        try (URLClassLoader ucl = new URLClassLoader(urls, null)) {\n            Thread.currentThread().setContextClassLoader(ucl);\n            try {\n                return invokeParser(ucl, args);\n            } catch (ClassNotFoundException e) {\n                Thread.currentThread().setContextClassLoader(originalCl);\n                try {\n                    return invokeParser(originalCl, args);\n                } catch (ClassNotFoundException classNotFoundException) {\n                    throw new RuntimeException(\"Failed to load parser\", e);\n                }\n            }\n        } catch (IOException e) {\n            throw new IllegalStateException(\"Failed to close URL classloader\", e);\n        } finally {\n            Thread.currentThread().setContextClassLoader(originalCl);","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/options/BootstrapMavenOptions.java#L77-L113","documentation":"After collecting URLs for every jar in the Maven lib directory plus the origin of BootstrapMavenOptions itself, parse() builds a URLClassLoader to invoke the Maven option parser. Any exception while listing/collecting the URLs (I/O errors, invalid paths, toURL failures) is wrapped in IllegalStateException 'Failed to create a URL list out of <mvnLib> content'.","triggerScenarios":"Calling BootstrapMavenOptions.newInstance()/parse() when Files.list(mvnLib) fails (permission denied), a file in <mavenHome>/lib cannot be converted to a URL (unencodable path/symlink loop), or getClassOrigin(BootstrapMavenOptions.class) throws while locating the class origin.","commonSituations":"Maven lib directory with restrictive permissions (installed via package manager, run as another user), broken symlinks in the lib dir, paths with characters that break URI conversion, or the bootstrap classes living somewhere unlocatable (e.g. nested jar on classpath).","solutions":["Check read/execute permissions on <mavenHome>/lib and its files for the current user","Inspect the wrapped cause to see which file failed; replace broken symlinks or reinstall the Maven distribution","Avoid spaces/special characters in the Maven installation path or quote/escape them properly","Ensure quarkus-bootstrap classes are on the classpath in a form whose origin can be located (directory or jar), not an unsupported launcher"],"exampleFix":"// before\nchmod 700 /opt/apache-maven/lib   // parser user cannot read\n// after\nchmod 755 /opt/apache-maven/lib && chmod 644 /opt/apache-maven/lib/*.jar","handlingStrategy":"validation","validationCode":"Path mvnLib = Path.of(mavenHome, \"lib\");\nif (!Files.isReadable(mvnLib) || !Files.isDirectory(mvnLib)) {\n    throw new IllegalStateException(\"Cannot read Maven lib dir: \" + mvnLib);\n}\ntry (Stream<Path> files = Files.list(mvnLib)) {\n    files.forEach(p -> {\n        if (!Files.isReadable(p)) throw new IllegalStateException(\"Unreadable jar: \" + p);\n    });\n}","typeGuard":null,"tryCatchPattern":"try {\n    BootstrapMavenOptions options = BootstrapMavenOptions.newInstance(cmdLine);\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Failed to create a URL list\")) {\n        throw new IllegalStateException(\"Check permissions/symlinks in Maven lib dir; cause: \" + e.getCause(), e);\n    }\n    throw e;\n}","preventionTips":["Run builds as a user with read access to the Maven installation directory","Avoid symlinks and special characters in the Maven installation path","Reinstall the distribution if lib/ contents look inconsistent","Ensure bootstrap classes are on a locatable classpath entry (plain jar or directory)"],"tags":["maven","classpath","io","environment"],"backgroundTag":"classpath-url-build-failed","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"}