{"record":{"id":"a3e7175fb627af15","repo":"jruby/jruby","slug":"file-already-closed","errorCode":null,"errorMessage":"file already closed","messagePattern":"file already closed","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/jruby/ext/ffi/io/FileDescriptorByteChannel.java","lineNumber":122,"sourceCode":"\n    /**\n     * Tests if the ByteChannel is open.\n     *\n     * @return <code>true</code> if the Channel is still open\n     */\n    public boolean isOpen() {\n        return isOpen;\n    }\n    /**\n     * Closes the <code>Channel</code>.\n     * <p>\n     * This closes the underlying native file descriptor.\n     * </p>\n     * @throws java.io.IOException\n     */\n    public void close() throws IOException {\n        if (!isOpen) {\n            throw new IllegalStateException(\"file already closed\");\n        }\n        isOpen = false;\n        libc.close(fd);\n    }\n}\n","sourceCodeStart":104,"sourceCodeEnd":128,"githubUrl":"https://github.com/jruby/jruby/blob/fb650c13e02b5a600fa66384655069d5ec30c362/core/src/main/java/org/jruby/ext/ffi/io/FileDescriptorByteChannel.java#L104-L128","documentation":"Error \"file already closed\" thrown in jruby/jruby.","triggerScenarios":"Thrown at core/src/main/java/org/jruby/ext/ffi/io/FileDescriptorByteChannel.java:122 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The underlying file descriptor was already closed. Reorder close operations or guard against double-close so the channel is not used after the descriptor is gone."],"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"}