{"record":{"id":"21c9e77cf60017b8","repo":"quarkusio/quarkus","slug":"failed-to-translate-21c9e7","errorCode":null,"errorMessage":"Failed to translate ","messagePattern":"Failed to translate ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/PathTreeClassPathElement.java","lineNumber":257,"sourceCode":"                    // (one with a trailing slash and one without) for same resource\n                    if (uri.getPath() != null && uri.getPath().endsWith(\"/\")) {\n                        String uriStr = uri.toString();\n                        url = new URL(uriStr.substring(0, uriStr.length() - 1));\n                    } else {\n                        url = uri.toURL();\n                    }\n                    if (url.getQuery() != null) {\n                        //huge hack to work around a JDK bug. ZipPath does not escape properly, so if there is a ?\n                        //in the path then it ends up in the query string and everything is screwy.\n                        //if there are multiple question marks the extra ones end up in the path and not the query string as you would expect\n                        url = new URL(url.getProtocol(), url.getHost(), url.getPort(),\n                                url.getPath().replaceAll(\"\\\\?\", \"%3F\") + \"%3F\" + url.getQuery());\n                    }\n                    return this.url = url;\n                }\n                return url = apply(this::getUrl);\n            } catch (MalformedURLException e) {\n                throw new RuntimeException(\"Failed to translate \" + path + \" to URL\", e);\n            } finally {\n                lock.readLock().unlock();\n            }\n        }\n\n        /**\n         * URL for this resource in a given {@link OpenPathTree}.\n         * If the path tree contains the resource, its URL is returned.\n         * Otherwise, the method returns null.\n         *\n         * @param tree path tree to look for the resource in\n         * @return resource URL if it exists in a given path tree or null if it does not\n         */\n        private URL getUrl(OpenPathTree tree) {\n            return tree.apply(name, Resource::getUrl);\n        }\n\n        /**","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/PathTreeClassPathElement.java#L239-L275","documentation":"Thrown from PathTreeClassPathElement.getUrl when translating the element's internal path into a java.net.URL fails with MalformedURLException, wrapped in a RuntimeException. This method builds runtime URLs for classpath elements (handling escaping of special characters like '?'). Failure means the resource path cannot be represented as a valid URL.","triggerScenarios":"Calling getUrl() on a PathTreeClassPathElement whose path contains characters that break URL parsing and are not correctly escaped (e.g. '?', spaces) so that MalformedURLException is thrown.","commonSituations":"Running from directories/jars whose names include '?' or other reserved URL characters; unusual build output locations.","solutions":["Rename the offending directory/jar to remove reserved URL characters ('?', '#', spaces)","Inspect the cause MalformedURLException to identify the offending character","Run the application from a conventional location (plain alphanumeric path)"],"exampleFix":"// before\n/path/to/my?app/runner.jar // '?' breaks URL translation\n// after\n/path/to/my_app/runner.jar","handlingStrategy":"validation","validationCode":"String p = path.toString();\nif (p.contains(\"?\") || p.contains(\"#\") || p.contains(\" \")) {\n    throw new IllegalStateException(\"path contains URL-reserved characters: \" + p);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid '?', '#', and spaces in application directory/jar names","Test the app from a simple alphanumeric path if URL errors appear","Check the MalformedURLException cause to find the offending character"],"tags":["classloading","url","filesystem"],"backgroundTag":"malformed-url","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"}