oracle/graal · error · UnsupportedOperationException
view <{}> is not supported
Error message
view <{}> is not supported What it means
Thrown by the private TruffleFileSystemProvider.getFileAttributeView(TrufflePath, String, ...) when the requested file-attribute-view name is anything other than 'basic'. The Truffle file system implements only the basic view; posix, unix, dos, owner, acl, and user views have no native backing. It is reached from readAttributes(Path, String, ...) where the view is the prefix before ':' in the attribute string.
Source
Thrown at espresso/src/com.oracle.truffle.espresso.io/src/sun/nio/fs/TruffleFileSystemProvider.java:317
return (V) new TruffleBasicFileAttributeView(TrufflePath.toTrufflePath(path), TrufflePath.followLinks(options));
}
@Override
@SuppressWarnings("unchecked")
public <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) throws IOException {
Objects.requireNonNull(type);
if (type != BasicFileAttributes.class) {
throw new UnsupportedOperationException();
}
return (A) getFileAttributeView(path, BasicFileAttributeView.class, options).readAttributes();
}
private TruffleBasicFileAttributeView getFileAttributeView(TrufflePath path, String type, LinkOption... options) {
Objects.requireNonNull(type);
if ("basic".equals(type)) {
return (TruffleBasicFileAttributeView) getFileAttributeView(path, BasicFileAttributeView.class, options);
}
throw new UnsupportedOperationException("view <" + type + "> is not supported");
}
@Override
public Map<String, Object> readAttributes(Path path, String attributes, LinkOption... options) throws IOException {
String view;
String attrs;
int colonPos = attributes.indexOf(':');
if (colonPos == -1) {
view = "basic";
attrs = attributes;
} else {
view = attributes.substring(0, colonPos++);
attrs = attributes.substring(colonPos);
}
return getFileAttributeView(TrufflePath.toTrufflePath(path), view, options).readAttributes(attrs);
}
@OverrideView on GitHub (pinned to a66e9ccd1d)
Solutions
- Use the basic view: Files.readAttributes(path, "basic:*") or BasicFileAttributes.class
- Guard with path.getFileSystem().supportedFileAttributeViews().contains("posix") before requesting posix attributes
- Wrap posix queries in try/catch UnsupportedOperationException and fall back to basic attributes
Example fix
// before
PosixFileAttributes attrs = Files.readAttributes(path, PosixFileAttributes.class);
// after
BasicFileAttributes attrs;
if (path.getFileSystem().supportedFileAttributeViews().contains("posix")) {
attrs = Files.readAttributes(path, PosixFileAttributes.class);
} else {
attrs = Files.readAttributes(path, BasicFileAttributes.class);
} Defensive patterns
Strategy: validation
Validate before calling
Set<String> views = path.getFileSystem().supportedFileAttributeViews();
String view = attributes.contains(":") ? attributes.substring(0, attributes.indexOf(':')) : "basic";
if (!views.contains(view)) {
attributes = "basic:lastModifiedTime,lastAccessTime,creationTime,size,isDirectory,isRegularFile";
} Try / catch
catch (UnsupportedOperationException e) { fall back to Files.readAttributes(path, BasicFileAttributes.class); } Prevention
- Query supportedFileAttributeViews() before requesting non-basic views
- Isolate POSIX attribute code behind an interface with a basic-view fallback implementation
When it happens
Trigger: Files.readAttributes(path, "posix:*"), readAttributes(path, "unix:size,lastModifiedTime", ...), or Files.getAttribute(path, "owner:owner") on a TrufflePath. Also Files.getPosixFileAttributes/Files.getFileAttributeView(path, PosixFileAttributeView.class) paths that funnel through the string form.
Common situations: Porting POSIX file code (permissions, uid/gid queries) to run inside an Espresso guest on Windows or on a host where only basic attributes are bridged; libraries like Apache Commons IO or sshd that query posix views unconditionally.
Related errors
- file attributes: {attrs}
- '{}' is unknown or read-only attribute
- Path component is undefined
- Path component should be '/'
- Query component present
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/005a91c6b19f6f16.
Report an issue: GitHub.