{"record":{"id":"b5b0b0f7002fe44b","repo":"jruby/jruby","slug":"stream-is-not-ready","errorCode":null,"errorMessage":"stream is not ready","messagePattern":"stream is not ready","errorType":"exception","errorClass":"Zlib::Error","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/jruby/ext/zlib/ZStream.java","lineNumber":246,"sourceCode":"    public IRubyObject close() {\n        return close(getCurrentContext());\n    }\n\n    @JRubyMethod(name = {\"close\", \"end\"})\n    public IRubyObject close(ThreadContext context) {\n        checkClosed(context);\n        internalClose();\n        closed = true;\n        return context.nil;\n    }\n\n    @Deprecated(since = \"10.0.0.0\")\n    void checkClosed() {\n        checkClosed(getCurrentContext());\n    }\n\n    void checkClosed(ThreadContext context) {\n        if (closed) throw RubyZlib.newZlibError(context, \"stream is not ready\");\n    }\n\n    // TODO: remove when JZlib checks the given level\n    static int checkLevel(ThreadContext context, int level) {\n        if ((level < 0 || level > 9) && level != JZlib.Z_DEFAULT_COMPRESSION) {\n            throw RubyZlib.newStreamError(context, \"stream error: invalid level\");\n        }\n        return level;\n    }\n\n    /**\n     * We only do windowBits=15(32K buffer, LZ77 algorithm) since java.util.zip\n     * only allows it. NOTE: deflateInit2 of zlib.c also accepts MAX_WBITS +\n     * 16(gzip compression). inflateInit2 also accepts MAX_WBITS + 16(gzip\n     * decompression) and MAX_WBITS + 32(automatic detection of gzip and LZ77).\n     */\n    // TODO: remove when JZlib checks the given windowBits\n    static int checkWindowBits(ThreadContext context, int value, boolean forInflate) {","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/jruby/jruby/blob/fb650c13e02b5a600fa66384655069d5ec30c362/core/src/main/java/org/jruby/ext/zlib/ZStream.java#L228-L264","documentation":"Error \"stream is not ready\" thrown in jruby/jruby.","triggerScenarios":"Thrown at core/src/main/java/org/jruby/ext/zlib/ZStream.java:246 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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()."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fb650c13e02b5a600fa66384655069d5ec30c362","analyzedAt":"2026-08-23T07:18:57.479Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}