apache/hadoop · error · IllegalArgumentException
is not an instance of Seekable or PositionedReadable
Error message
${className} is not an instance of Seekable or PositionedReadable What it means
Thrown from the FSDataInputStream constructor when the wrapped stream implements neither Seekable nor PositionedReadable. FSDataInputStream's contract requires at least one of those interfaces, so the incompatible inner stream class is named and rejected.
Solutions
- Wrap the stream only if the underlying stream implements Seekable or PositionedReadable.
- Use a filesystem open() call that returns a compliant stream instead of wrapping an arbitrary InputStream.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FSDataInputStream.java:62 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/dceabb8413458fe3.
Report an issue: GitHub.
Appendix: source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FSDataInputStream.java:62
@InterfaceAudience.Public
@InterfaceStability.Stable
public class FSDataInputStream extends DataInputStream
implements Seekable, PositionedReadable,
ByteBufferReadable, HasFileDescriptor, CanSetDropBehind, CanSetReadahead,
HasEnhancedByteBufferAccess, CanUnbuffer, StreamCapabilities,
ByteBufferPositionedReadable, IOStatisticsSource {
/**
* Map ByteBuffers that we have handed out to readers to ByteBufferPool
* objects
*/
private final IdentityHashStore<ByteBuffer, ByteBufferPool>
extendedReadBuffers
= new IdentityHashStore<>(0);
public FSDataInputStream(InputStream in) {
super(in);
if( !(in instanceof Seekable) || !(in instanceof PositionedReadable) ) {
throw new IllegalArgumentException(in.getClass().getCanonicalName() +
" is not an instance of Seekable or PositionedReadable");
}
}
/**
* Seek to the given offset.
*
* @param desired offset to seek to
*/
@Override
public void seek(long desired) throws IOException {
((Seekable)in).seek(desired);
}
/**
* Get the current position in the input stream.
*
* @return current position in the input streamView on GitHub (pinned to 2add963021)