oracle/graal · error · IllegalArgumentException

Query component present

Error message

Query component present

What it means

Thrown by TruffleFileSystemProvider.checkUri when the URI contains a query component (uri.getRawQuery() != null). The Truffle file system URI is strictly 'scheme:/' with no authority, query, or fragment; a query string such as 'truffle:/?key=value' is rejected. This mirrors the validation style of the JDK's built-in providers.

Source

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

        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 {
        checkUri(uri);
        throw new FileSystemAlreadyExistsException();
    }

    @Override
    public FileSystem getFileSystem(URI uri) {
        checkUri(uri);
        return theFileSystem;
    }

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Remove the query string and use exactly URI.create("truffle:/")
  2. Pass configuration through the env Map parameter of newFileSystem, not the URI
  3. Sanitize user-supplied URI strings before handing them to the provider

Example fix

// before
URI uri = URI.create("truffle:/?mode=ro");
FileSystem fs = FileSystems.getFileSystem(uri);

// after
URI uri = URI.create("truffle:/");
FileSystem fs = FileSystems.getFileSystem(uri);
Defensive patterns

Strategy: validation

Validate before calling

if (uri.getRawQuery() != null) { /* strip or reject before calling the provider */
    throw new IllegalArgumentException("query not allowed in Truffle FS URI");
}

Prevention

When it happens

Trigger: Passing a URI like URI.create("truffle:/?readonly=true") to newFileSystem/getFileSystem/getPath, often copied from patterns where env-style options are encoded in the query string.

Common situations: Porting code that targets zipfs (where env options occasionally get stuffed into URIs) or hand-building URIs with URLEncoder for configuration parameters.

Related errors


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