apache/hadoop · error · NullPointerException
ZstdDecompressCtx is not initialized
Error message
ZstdDecompressCtx is not initialized
What it means
Thrown by ZStandardDecompressor.checkStream when the zstd JNI decompression context is null after end() or before init. Null-state guard: decompress/getRemaining/reset on a disposed context fail immediately.
Solutions
- Ensure the native zstd library loaded successfully and the decompressor context was initialized; do not use the decompressor after close().
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zstd/ZStandardDecompressor.java:254 when the library encounters an invalid state.
Common situations: Occurs when the native Zstd decompression context is not initialized. Initialize the decompressor before use and do not call decompress after close.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/efeffde0edbe91ae.
Report an issue: GitHub.
Appendix: source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zstd/ZStandardDecompressor.java:254
userBufferBytesToConsume = 0;
}
@Override
public void end() {
if (zstdJniCtx != null) {
zstdJniCtx.close();
zstdJniCtx = null;
}
}
@Override
protected void finalize() {
end();
}
private void checkStream() {
if (zstdJniCtx == null) {
throw new NullPointerException("ZstdDecompressCtx is not initialized");
}
}
private int populateUncompressedBuffer(byte[] b, int off, int len, int n) {
n = Math.min(n, len);
uncompressedDirectBuf.get(b, off, n);
return n;
}
int inflateDirect(ByteBuffer src, ByteBuffer dst) {
assert (this instanceof ZStandardDecompressor.ZStandardDirectDecompressor);
int origDstPos = dst.position();
boolean done = zstdJniCtx.decompressDirectByteBufferStream(dst, src);
remaining = src.limit() - src.position();
// Mirror decompress(): only mark finished when the frame is done AND no
// more bytes remain (src may contain additional concatenated frames).
if (done && remaining == 0) {View on GitHub (pinned to 2add963021)