{"record":{"id":"901ca8b6f0cc1fac","repo":"oracle/graal","slug":"authority-component-present","errorCode":null,"errorMessage":"Authority component present","messagePattern":"Authority component present","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"espresso/src/com.oracle.truffle.espresso.io/src/sun/nio/fs/TruffleFileSystemProvider.java","lineNumber":84,"sourceCode":"    TruffleFileSystemProvider() {\n        this.theFileSystem = new TruffleFileSystem(this);\n    }\n\n    TruffleFileSystem theFileSystem() {\n        return theFileSystem;\n    }\n\n    @Override\n    public String getScheme() {\n        return SCHEME;\n    }\n\n    private void checkUri(URI uri) {\n        if (!uri.getScheme().equalsIgnoreCase(getScheme())) {\n            throw new IllegalArgumentException(\"URI does not match this provider\");\n        }\n        if (uri.getRawAuthority() != null) {\n            throw new IllegalArgumentException(\"Authority component present\");\n        }\n        String path = uri.getPath();\n        if (path == null) {\n            throw new IllegalArgumentException(\"Path component is undefined\");\n        }\n        if (!path.equals(\"/\")) {\n            throw new IllegalArgumentException(\"Path component should be '/'\");\n        }\n        if (uri.getRawQuery() != null) {\n            throw new IllegalArgumentException(\"Query component present\");\n        }\n        if (uri.getRawFragment() != null) {\n            throw new IllegalArgumentException(\"Fragment component present\");\n        }\n    }\n\n    @Override\n    public FileSystem newFileSystem(URI uri, Map<String, ?> env) throws IOException {","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/espresso/src/com.oracle.truffle.espresso.io/src/sun/nio/fs/TruffleFileSystemProvider.java#L66-L102","documentation":"Second check in TruffleFileSystemProvider.checkUri: a filesystem URI for this provider must have no authority component (no host:port). If uri.getRawAuthority() != null, IllegalArgumentException('Authority component present') is thrown, matching the NIO rule that provider filesystem URIs are authority-free.","triggerScenarios":"Passing URIs like 'scheme://host/path' or 'scheme://somehost/' (URI.create or new URI(scheme, host, path, null) which always sets an authority when host is non-null) to the provider's newFileSystem/getFileSystem.","commonSituations":"URIs built with the two/three-argument java.net.URI constructors that embed a host; URLs converted via URL.toURI() keeping their authority; code assuming remote filesystems are addressable via the authority.","solutions":["Build the URI without authority: new URI(scheme, null, path, null) or URI.create(scheme + \":/\").","Strip the authority before passing: URI with getRawAuthority() == null.","Route remote paths through the provider's own configuration, not the URI authority."],"exampleFix":"// before\nURI uri = new URI(\"truffle\", \"host1\", \"/\", null); // authority 'host1' -> throws\n\n// after\nURI uri = new URI(\"truffle\", null, \"/\", null); // no authority component","handlingStrategy":"validation","validationCode":"if (uri.getRawAuthority() == null && uri.getRawQuery() == null && uri.getRawFragment() == null) {\n    provider.newFileSystem(uri, env);\n}","typeGuard":null,"tryCatchPattern":"try {\n    provider.newFileSystem(uri, env);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().equals(\"Authority component present\")) {\n        URI clean = URI.create(uri.getScheme() + \":/\" + uri.getPath());\n        provider.newFileSystem(clean, env);\n    }\n}","preventionTips":["Build filesystem URIs with new URI(scheme, null, path, null) so no authority is set.","Be wary of URL.toURI(): URLs almost always carry an authority."],"tags":["espresso","nio","uri","validation"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}