{"record":{"id":"09f56bc024a31ba5","repo":"oracle/graal","slug":"access-mode","errorCode":null,"errorMessage":"access mode: {}","messagePattern":"access mode: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"espresso/src/com.oracle.truffle.espresso.io/src/sun/nio/fs/TruffleFileSystemProvider.java","lineNumber":280,"sourceCode":"    }\n\n    @Override\n    public FileStore getFileStore(Path path) {\n        return new TruffleFileStore(path);\n    }\n\n    // Keep in sync with Target_*_TruffleFileSystemProvider#SUPPORTED_ACCESS_MODES.\n    private static final List<AccessMode> SUPPORTED_ACCESS_MODES = List.of(\n                    AccessMode.READ,\n                    AccessMode.WRITE,\n                    AccessMode.EXECUTE);\n\n    private static int accessModesToMask(AccessMode... modes) {\n        int mask = 0;\n        for (AccessMode mode : modes) {\n            int index = SUPPORTED_ACCESS_MODES.indexOf(mode);\n            if (index < 0) {\n                throw new UnsupportedOperationException(\"access mode: \" + mode);\n            }\n            mask |= 1 << index;\n        }\n        return mask;\n    }\n\n    @Override\n    public void checkAccess(Path path, AccessMode... modes) throws IOException {\n        checkAccess0(TrufflePath.toTrufflePath(path), accessModesToMask(modes));\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options) {\n        Objects.requireNonNull(type);\n        if (type != BasicFileAttributeView.class) {\n            throw new UnsupportedOperationException();\n        }","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/espresso/src/com.oracle.truffle.espresso.io/src/sun/nio/fs/TruffleFileSystemProvider.java#L262-L298","documentation":"Thrown by TruffleFileSystemProvider.accessModesToMask when an AccessMode passed to checkAccess is not READ, WRITE, or EXECUTE. AccessMode is an enum with exactly those three constants, so hitting this means a custom AccessMode-like value or a version skew between the host list and the guest-side Target_*_TruffleFileSystemProvider#SUPPORTED_ACCESS_MODES it must stay in sync with.","triggerScenarios":"Files.isReadable/isWritable/isExecutable never trigger it (they pass single constants); it fires only if a caller supplies a non-enum AccessMode from a recompiled/patched java.nio or a mismatched Espresso build where the host and guest lists diverge.","commonSituations":"Running a guest JDK whose java.nio.fs was modified or built from a different source, or class-path shadowing of java.nio.file.AccessMode; mixing Espresso component versions.","solutions":["Use only AccessMode.READ, AccessMode.WRITE, AccessMode.EXECUTE","Ensure the Espresso guest and host builds match (the SUPPORTED_ACCESS_MODES lists must stay in sync)","Check the guest classpath for shadowed/patched java.nio classes"],"exampleFix":"// before (hypothetical patched enum value)\nprovider.checkAccess(path, AccessMode.READ, customMode);\n\n// after\nprovider.checkAccess(path, AccessMode.READ, AccessMode.WRITE);","handlingStrategy":"validation","validationCode":"for (AccessMode m : modes) {\n    if (!(m == AccessMode.READ || m == AccessMode.WRITE || m == AccessMode.EXECUTE)) {\n        throw new UnsupportedOperationException(\"access mode: \" + m);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the three standard constants; AccessMode has no other legal values","Keep host and guest Espresso components on the same version so SUPPORTED lists stay in sync"],"tags":["espresso","nio","access-mode","file-system","truffle"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}