{"record":{"id":"41ab3b6f48b21ca8","repo":"oracle/graal","slug":"getattribute-is-not-supported","errorCode":null,"errorMessage":"getAttribute is not supported.","messagePattern":"getAttribute is not supported\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"espresso/src/com.oracle.truffle.espresso.io/src/sun/nio/fs/TruffleFileStore.java","lineNumber":88,"sourceCode":"\n    @Override\n    public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) {\n        return type == BasicFileAttributeView.class;\n    }\n\n    @Override\n    public boolean supportsFileAttributeView(String name) {\n        return \"basic\".equals(name);\n    }\n\n    @Override\n    public <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type) {\n        return null;\n    }\n\n    @Override\n    public Object getAttribute(String attribute) throws IOException {\n        throw new UnsupportedOperationException(\"getAttribute is not supported.\");\n    }\n\n    private static native boolean isReadOnly0(TrufflePath path);\n\n    private static native long totalSpace0(TrufflePath path);\n\n    private static native long getUsableSpace0(TrufflePath path);\n\n    private static native long getUnallocatedSpace0(TrufflePath path);\n}\n","sourceCodeStart":70,"sourceCodeEnd":99,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/espresso/src/com.oracle.truffle.espresso.io/src/sun/nio/fs/TruffleFileStore.java#L70-L99","documentation":"TruffleFileStore implements only space/read-only queries natively (totalSpace0, getUsableSpace0, getUnallocatedSpace0, isReadOnly0) and no file-store attribute views; FileStore.getAttribute therefore always throws UnsupportedOperationException. This is a declared capability gap of Espresso's Truffle NIO provider, mirroring a minimal FileStore.","triggerScenarios":"Guest code calling Files.getFileStore(path).getAttribute(\"totalSpace\") or any attribute name; requesting a FileStoreAttributeView via getFileStoreAttributeView (returns null, then NPE/UsageError downstream).","commonSituations":"Monitoring/diagnostic libraries (disk usage checks, quota tools) that call FileStore.getAttribute; portable code that works on the default provider but runs on the Truffle provider under Espresso.","solutions":["Use FileStore.getTotalSpace()/getUsableSpace()/getUnallocatedSpace()/isReadOnly() methods directly instead of getAttribute(String).","Branch on the provider (scheme/name) and skip attribute queries for the Truffle FS.","For host-accurate values, perform the query in host code and pass results into the guest."],"exampleFix":"// before\nlong total = (long) Files.getFileStore(p).getAttribute(\"totalSpace\"); // throws\n\n// after\nlong total = Files.getFileStore(p).getTotalSpace();","handlingStrategy":"fallback","validationCode":"FileStore fs = Files.getFileStore(p);\nif (!\"getAttribute is supported\".isEmpty()) { /* never call fs.getAttribute; use typed getters */ }\nlong total = fs.getTotalSpace();","typeGuard":null,"tryCatchPattern":"try {\n    Object v = fs.getAttribute(name);\n} catch (UnsupportedOperationException e) {\n    // fall back to typed getters: getTotalSpace()/getUsableSpace()/isReadOnly()\n}","preventionTips":["Never call FileStore.getAttribute under the Truffle provider; use typed getters.","Feature-detect the filesystem provider in portable disk-usage code."],"tags":["espresso","nio","filestore","unsupported-operation"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}