{"record":{"id":"364e6ecee5d56049","repo":"quarkusio/quarkus","slug":"unexpected-protocol-protocol-for-url-url","errorCode":null,"errorMessage":"Unexpected protocol <protocol> for URL <url>","messagePattern":"Unexpected protocol <protocol> for URL <url>","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/descriptor/loader/json/ResourceLoaders.java","lineNumber":77,"sourceCode":"            } catch (MalformedURLException e) {\n                throw new RuntimeException(\"Failed to create a URL for '\" + file.substring(0, exclam) + \"'\", e);\n            }\n            try (FileSystem jarFs = ZipUtils.newFileSystem(jar)) {\n                Path localPath = jarFs.getPath(\"/\");\n                if (exclam >= 0) {\n                    localPath = localPath.resolve(file.substring(exclam + 1));\n                }\n                return function.apply(localPath);\n            } catch (IOException e) {\n                throw new UncheckedIOException(\"Failed to read \" + jar, e);\n            }\n        }\n\n        if (FILE.equals(url.getProtocol())) {\n            return function.apply(toLocalPath(url));\n        }\n\n        throw new IllegalArgumentException(\"Unexpected protocol \" + url.getProtocol() + \" for URL \" + url);\n    }\n\n    private static Path toLocalPath(final URL url) {\n        try {\n            return Paths.get(url.toURI());\n        } catch (URISyntaxException e) {\n            throw new IllegalArgumentException(\"Failed to translate \" + url + \" to local path\", e);\n        }\n    }\n}\n","sourceCodeStart":59,"sourceCodeEnd":88,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/descriptor/loader/json/ResourceLoaders.java#L59-L88","documentation":"processAsPath only supports two URL protocols: nested JAR handling and 'file'. Any other protocol (http, https, jrt, custom) cannot be converted to a filesystem Path, so it throws IllegalArgumentException with the protocol and URL in the message.","triggerScenarios":"Passing a URL with protocol other than 'file' (or a supported jar/zip layout) to loadResourceAsPath/processAsPath — e.g. a URL obtained from an HTTP classloader or a remote repository.","commonSituations":"Loading platform descriptors from remote Maven repositories over http(s); OSGi or jrt: URLs in modular runtimes; custom URL stream handlers registered by application servers.","solutions":["Resolve the resource to a local file first (download/copy it) and pass a file: URL or Path instead","Check where the URL comes from and use a loader appropriate for that protocol (e.g. URL.openStream for remote resources)","If this is a Quarkus tool invocation, ensure the descriptor artifact is resolved locally by Maven before descriptor loading"],"exampleFix":"// before\nload(urlFromRemoteRepo); // https URL -> IllegalArgumentException\n// after\nPath local = artifactResolver.resolve(artifact).getArtifact().getPath();\nload(local.toUri().toURL());","handlingStrategy":"type-guard","validationCode":"static boolean supportedUrl(URL url) {\n    return \"file\".equals(url.getProtocol()) || \"jar\".equals(url.getProtocol());\n}","typeGuard":"static boolean isFileOrJar(URL url) {\n    String p = url.getProtocol();\n    return \"file\".equals(p) || p.endsWith(\"jar\") || p.endsWith(\"zip\");\n}","tryCatchPattern":"try {\n    return ResourceLoaders.processAsPath(url, fn);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unexpected protocol\")) {\n        // download to a temp file and retry with a file URL\n        return ResourceLoaders.processAsPath(downloadToTempFile(url).toUri().toURL(), fn);\n    }\n    throw e;\n}","preventionTips":["Resolve remote artifacts to local files with MavenArtifactResolver before descriptor loading","Check url.getProtocol() before calling loader APIs","Avoid classloaders that return http(s)-protocol resource URLs"],"tags":["url","protocol","unsupported"],"backgroundTag":"unsupported-url-protocol","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"}