oracle/graal · error · IllegalArgumentException

Authority component present

Error message

Authority component present

What it means

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.

Source

Thrown at espresso/src/com.oracle.truffle.espresso.io/src/sun/nio/fs/TruffleFileSystemProvider.java:84

    TruffleFileSystemProvider() {
        this.theFileSystem = new TruffleFileSystem(this);
    }

    TruffleFileSystem theFileSystem() {
        return theFileSystem;
    }

    @Override
    public String getScheme() {
        return SCHEME;
    }

    private void checkUri(URI uri) {
        if (!uri.getScheme().equalsIgnoreCase(getScheme())) {
            throw new IllegalArgumentException("URI does not match this provider");
        }
        if (uri.getRawAuthority() != null) {
            throw new IllegalArgumentException("Authority component present");
        }
        String path = uri.getPath();
        if (path == null) {
            throw new IllegalArgumentException("Path component is undefined");
        }
        if (!path.equals("/")) {
            throw new IllegalArgumentException("Path component should be '/'");
        }
        if (uri.getRawQuery() != null) {
            throw new IllegalArgumentException("Query component present");
        }
        if (uri.getRawFragment() != null) {
            throw new IllegalArgumentException("Fragment component present");
        }
    }

    @Override
    public FileSystem newFileSystem(URI uri, Map<String, ?> env) throws IOException {

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Build the URI without authority: new URI(scheme, null, path, null) or URI.create(scheme + ":/").
  2. Strip the authority before passing: URI with getRawAuthority() == null.
  3. Route remote paths through the provider's own configuration, not the URI authority.

Example fix

// before
URI uri = new URI("truffle", "host1", "/", null); // authority 'host1' -> throws

// after
URI uri = new URI("truffle", null, "/", null); // no authority component
Defensive patterns

Strategy: validation

Validate before calling

if (uri.getRawAuthority() == null && uri.getRawQuery() == null && uri.getRawFragment() == null) {
    provider.newFileSystem(uri, env);
}

Try / catch

try {
    provider.newFileSystem(uri, env);
} catch (IllegalArgumentException e) {
    if (e.getMessage().equals("Authority component present")) {
        URI clean = URI.create(uri.getScheme() + ":/" + uri.getPath());
        provider.newFileSystem(clean, env);
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/901ca8b6f0cc1fac. Report an issue: GitHub.