{"record":{"id":"1273082cd013c34a","repo":"oracle/graal","slug":"fragment-component-present","errorCode":null,"errorMessage":"Fragment component present","messagePattern":"Fragment 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":97,"sourceCode":"    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 {\n        checkUri(uri);\n        throw new FileSystemAlreadyExistsException();\n    }\n\n    @Override\n    public FileSystem getFileSystem(URI uri) {\n        checkUri(uri);\n        return theFileSystem;\n    }\n\n    @Override\n    public Path getPath(URI uri) {\n        return new TrufflePath(theFileSystem(), uri.getPath());","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/espresso/src/com.oracle.truffle.espresso.io/src/sun/nio/fs/TruffleFileSystemProvider.java#L79-L115","documentation":"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.","triggerScenarios":"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.","commonSituations":"Reusing URL/bookmark-style URI constants that carry fragments, or concatenating a fragment-bearing string onto the scheme prefix.","solutions":["Use exactly URI.create(\"truffle:/\") with no fragment","Strip fragments with new URI(uri.getScheme(), uri.getSchemeSpecificPart(), null) before passing the URI on","Lint configuration files for URI strings containing '#'"],"exampleFix":"// before\nURI uri = URI.create(\"truffle:/#cfg\");\nFileSystem fs = FileSystems.getFileSystem(uri);\n\n// after\nURI uri = URI.create(\"truffle:/\");\nFileSystem fs = FileSystems.getFileSystem(uri);","handlingStrategy":"validation","validationCode":"if (uri.getRawFragment() != null) {\n    throw new IllegalArgumentException(\"fragment not allowed in Truffle FS URI\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Strip fragments when normalizing externally supplied URIs","Use new URI(scheme, ssp, null) when rebuilding URIs"],"tags":["espresso","nio","uri","filesystem","truffle"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}