oracle/graal · error · IllegalArgumentException

Fragment component present

Error message

Fragment component present

What it means

Thrown by TruffleFileSystemProvider.checkUri when the URI contains a fragment component (uri.getRawFragment() != null), e.g. 'truffle:/#section'. The provider accepts only the bare root URI 'scheme:/' with no authority, query, or fragment, so any fragment makes the URI invalid for this file system.

Source

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

    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;
    }

    @Override
    public Path getPath(URI uri) {
        return new TrufflePath(theFileSystem(), uri.getPath());

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Use exactly URI.create("truffle:/") with no fragment
  2. Strip fragments with new URI(uri.getScheme(), uri.getSchemeSpecificPart(), null) before passing the URI on
  3. Lint configuration files for URI strings containing '#'

Example fix

// before
URI uri = URI.create("truffle:/#cfg");
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.getRawFragment() != null) {
    throw new IllegalArgumentException("fragment not allowed in Truffle FS URI");
}

Prevention

When it happens

Trigger: Calling newFileSystem/getFileSystem/getPath with URI.create("truffle:/#anchor") or with a URI built via new URI(scheme, ssp, fragment) where a fragment was supplied.

Common situations: Reusing URL/bookmark-style URI constants that carry fragments, or concatenating a fragment-bearing string onto the scheme prefix.

Related errors


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