jruby/jruby · error · IOException

Mark is invalidated.

Error message

Mark is invalidated.

What it means

Error "Mark is invalidated." thrown in jruby/jruby.

Source

Thrown at core/src/main/java/org/jruby/embed/io/ReaderInputStream.java:467

     *     to subsequent callers of the <code>read</code> method depend on the
     *     particular type of the input stream. </ul></ul>
     *
     * @exception  IOException  if this stream has not been marked or if the
     *               mark has been invalidated.
     * @see     java.io.InputStream#mark(int)
     * @see     java.io.IOException
     */
    @Override
    public synchronized void reset() throws IOException {
        synchronized (lock) {
            if (!isOpen) {
                throw new IOException("This stream has been closed.");
            }
            if (markedIndex < 0) {
                throw new IOException("This stream is not marked.");
            }
            if ((position - markedIndex) > readlimit) {
                throw new IOException("Mark is invalidated.");
            }
            position = markedIndex;
        }
    }

    /**
     * Skips over and discards <code>n</code> bytes of data from this input
     * stream. The <code>skip</code> method may, for a variety of reasons, end
     * up skipping over some smaller number of bytes, possibly <code>0</code>.
     * This may result from any of a number of conditions; reaching end of file
     * before <code>n</code> bytes have been skipped is only one possibility.
     * The actual number of bytes skipped is returned.  If <code>n</code> is
     * negative, no bytes are skipped.
     *
     * @param      n   the number of bytes to be skipped.
     * @return     the actual number of bytes skipped.
     * @exception  IOException  if the stream does not support seek,
     *                          or if some other I/O error occurs.

View on GitHub (pinned to fb650c13e0)

Solutions

  1. reset() was called after reading past the mark's read limit, invalidating the mark. Re-mark the stream, or call reset() before exceeding the readlimit.

When it happens

Trigger: Thrown at core/src/main/java/org/jruby/embed/io/ReaderInputStream.java:467 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/4dcfe2b1ebf114be. Report an issue: GitHub.