{"record":{"id":"b5552f28e1180699","repo":"quarkusio/quarkus","slug":"failed-to-translate","errorCode":null,"errorMessage":"Failed to translate ","messagePattern":"Failed to translate ","errorType":"exception","errorClass":"java.lang.RuntimeException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/PathVisit.java","lineNumber":43,"sourceCode":"     *\n     * The returned path is granted to exist in the underlying file system (unless it was deleted by a parallel process or\n     * thread) and therefore it can be used for I/O operations straight away without further resolving, e.g. against\n     * {@link #getRoot()}\n     *\n     * @return path being visited\n     */\n    Path getPath();\n\n    /**\n     * {@link java.net.URL} that can be used to read the content of the path.\n     *\n     * @return URL that can be used to read the content of the path\n     */\n    default URL getUrl() {\n        try {\n            return getPath().toUri().toURL();\n        } catch (MalformedURLException e) {\n            throw new RuntimeException(\"Failed to translate \" + getPath().toUri() + \" to \" + URL.class.getName(), e);\n        }\n    }\n\n    /**\n     * Visited class path resource name.\n     *\n     * @return visited resource name\n     */\n    default String getResourceName() {\n        return getRelativePath(\"/\");\n    }\n\n    /**\n     * Path relative to the root of the tree as a string with {@code /} as a path element separator.\n     * This method calls {@link #getRelativePath(String)} passing {@code /} as an argument.\n     *\n     * @return path relative to the root of the tree as a string with {@code /} as a path element separator\n     */","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/PathVisit.java#L25-L61","documentation":"PathVisit.getUrl() converts the visited path to a URL via Path.toUri().toURL(). MalformedURLException is rethrown as a RuntimeException including the URI and target type. For file paths this practically never fails; it indicates a malformed/unexpected URI for the visited resource.","triggerScenarios":"Calling getUrl() on a PathVisit whose path cannot be translated to a valid URL — typically only when the URI is malformed (illegal characters in scheme/path) or a custom FileSystem provider produces a non-convertible URI.","commonSituations":"Paths with characters that corrupt the URI (spaces, unencoded special chars) on unusual filesystems; custom jar/jandex filesystem providers; rarely hit for plain files.","solutions":["Inspect the URI in the message for illegal characters and fix how the path was constructed (encode spaces/special chars)","Prefer reading content via OpenablePathTree/open() streams instead of getUrl()","Report upstream with the exact path if a standard path tree produced it"],"exampleFix":"// before\nURL url = visit.getUrl();\n// after\ntry (InputStream in = Files.newInputStream(visit.getPath())) { /* read */ }","handlingStrategy":"try-catch","validationCode":"try { visit.getPath().toUri().toURL(); } catch (MalformedURLException e) { /* fall back to stream access */ }","typeGuard":null,"tryCatchPattern":"try { URL url = visit.getUrl(); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"Failed to translate\")) { readViaStream(visit.getPath()); } else { throw e; } }","preventionTips":["Prefer stream/Files-based reads over URL conversion","Ensure paths have valid URI characters (encode spaces)","Report non-convertible standard paths upstream"],"tags":["url","classpath","encoding"],"backgroundTag":"malformed-url-conversion","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}