jruby/jruby · error · Zlib::Error
stream is not ready
Error message
stream is not ready
What it means
Error "stream is not ready" thrown in jruby/jruby.
Source
Thrown at core/src/main/java/org/jruby/ext/zlib/ZStream.java:246
public IRubyObject close() {
return close(getCurrentContext());
}
@JRubyMethod(name = {"close", "end"})
public IRubyObject close(ThreadContext context) {
checkClosed(context);
internalClose();
closed = true;
return context.nil;
}
@Deprecated(since = "10.0.0.0")
void checkClosed() {
checkClosed(getCurrentContext());
}
void checkClosed(ThreadContext context) {
if (closed) throw RubyZlib.newZlibError(context, "stream is not ready");
}
// TODO: remove when JZlib checks the given level
static int checkLevel(ThreadContext context, int level) {
if ((level < 0 || level > 9) && level != JZlib.Z_DEFAULT_COMPRESSION) {
throw RubyZlib.newStreamError(context, "stream error: invalid level");
}
return level;
}
/**
* We only do windowBits=15(32K buffer, LZ77 algorithm) since java.util.zip
* only allows it. NOTE: deflateInit2 of zlib.c also accepts MAX_WBITS +
* 16(gzip compression). inflateInit2 also accepts MAX_WBITS + 16(gzip
* decompression) and MAX_WBITS + 32(automatic detection of gzip and LZ77).
*/
// TODO: remove when JZlib checks the given windowBits
static int checkWindowBits(ThreadContext context, int value, boolean forInflate) {View on GitHub (pinned to fb650c13e0)
Solutions
- The zlib stream was used before it was ready (not initialized or already ended). Initialize/reset the stream before use and do not use it after end().
When it happens
Trigger: Thrown at core/src/main/java/org/jruby/ext/zlib/ZStream.java:246 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of jruby/jruby@fb650c13e0 (2026-08-23).
Data as JSON: /api/errors/b5b0b0f7002fe44b.
Report an issue: GitHub.