{"record":{"id":"1dfcc976911b4b84","repo":"jwtk/jjwt","slug":"mark-reset-not-supported","errorCode":null,"errorMessage":"mark/reset not supported","messagePattern":"mark/reset not supported","errorType":"exception","errorClass":"java.io.IOException","httpStatus":null,"severity":"error","filePath":"impl/src/main/java/io/jsonwebtoken/impl/io/BaseNCodecInputStream.java","lineNumber":206,"sourceCode":"                // Return the amount read or EOF\n                return readLen != 0 ? readLen : -1;\n            }\n            readLen += read;\n        }\n        return readLen;\n    }\n\n    /**\n     * Repositions this stream to the position at the time the mark method was last called on this input stream.\n     * <p>\n     * The {@link #reset} method of {@link BaseNCodecInputStream} does nothing except throw an {@link IOException}.\n     *\n     * @throws IOException if this method is invoked\n     * @since 1.7\n     */\n    @Override\n    public synchronized void reset() throws IOException {\n        throw new IOException(\"mark/reset not supported\");\n    }\n\n    /**\n     * {@inheritDoc}\n     *\n     * @throws IllegalArgumentException if the provided skip length is negative\n     * @since 1.7\n     */\n    @Override\n    public long skip(final long n) throws IOException {\n        if (n < 0) {\n            throw new IllegalArgumentException(\"Negative skip length: \" + n);\n        }\n\n        // skip in chunks of 512 bytes\n        final byte[] b = new byte[512];\n        long todo = n;\n","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/jwtk/jjwt/blob/fb71496164c71442d08adec4571d9616ed5e1b8d/impl/src/main/java/io/jsonwebtoken/impl/io/BaseNCodecInputStream.java#L188-L224","documentation":"BaseNCodecInputStream never supports mark/reset: reset() is a guard that unconditionally throws IOException. It fires whenever a caller (e.g. code wrapping the decoded stream in a PushbackInputStream-like flow or calling reset directly after mark) attempts to reposition a Base64/Base32/Base16 decoding stream, which cannot buffer arbitrary look-ahead.","triggerScenarios":"Thrown at impl/src/main/java/io/jsonwebtoken/impl/io/BaseNCodecInputStream.java:206 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check InputStream#markSupported() before calling mark/reset and avoid reset on this stream type","Wrap the stream in a BufferedInputStream with a sufficient buffer size if mark/reset semantics are required","Read the full stream into a byte[] (or use IOUtils.toByteArray) and re-open a new stream from the buffer to 'replay' the data"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fb71496164c71442d08adec4571d9616ed5e1b8d","analyzedAt":"2026-09-09T00:33:09.982Z","contentChangedAt":"2026-09-09T00:33:09.982Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}