{"record":{"id":"2825b2758aa68b55","repo":"OpenFeign/feign","slug":"mark-not-supported-2825b2","errorCode":null,"errorMessage":"Mark not supported","messagePattern":"Mark not supported","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"dropwizard-metrics5/src/main/java/feign/metrics5/CountingInputStream.java","lineNumber":85,"sourceCode":"\n  @Override\n  public long skip(long n) throws IOException {\n    final long result = in.skip(n);\n    count += result;\n    return result;\n  }\n\n  @Override\n  public synchronized void mark(int readlimit) {\n    in.mark(readlimit);\n    mark = count;\n    // it's okay to mark even if mark isn't supported, as reset won't work\n  }\n\n  @Override\n  public synchronized void reset() throws IOException {\n    if (!in.markSupported()) {\n      throw new IOException(\"Mark not supported\");\n    }\n    if (mark == -1) {\n      throw new IOException(\"Mark not set\");\n    }\n\n    in.reset();\n    count = mark;\n  }\n}\n","sourceCodeStart":67,"sourceCodeEnd":95,"githubUrl":"https://github.com/OpenFeign/feign/blob/e2a1e27560a1e68840c34f031afca88b36096e30/dropwizard-metrics5/src/main/java/feign/metrics5/CountingInputStream.java#L67-L95","documentation":"The metrics5 CountingInputStream.reset() throws IOException(\"Mark not supported\") when the wrapped stream does not support mark/reset. Behavior is identical to the metrics4 variant; mark support is delegated to the underlying stream.","triggerScenarios":"Calling reset() on a feign.metrics5 CountingInputStream whose underlying stream has markSupported() == false.","commonSituations":"Re-reading response bodies for retries/metrics when the source is an unbuffered network stream.","solutions":["Wrap the source in a BufferedInputStream before CountingInputStream","Check markSupported() before resetting","Call mark() before reading"],"exampleFix":"// before\nnew CountingInputStream(connection.getInputStream(), clock);\n// after\nnew CountingInputStream(new BufferedInputStream(connection.getInputStream()), clock);","handlingStrategy":"validation","validationCode":"if (in.markSupported()) { /* safe to reset */ }","typeGuard":null,"tryCatchPattern":"try {\n  in.reset();\n} catch (IOException e) {\n  // fall back to re-requesting the resource\n}","preventionTips":["Buffer network streams before wrapping in metrics CountingInputStream","Verify markSupported() before reset","Mark before read when replay is expected"],"tags":["io","stream","mark-reset"],"backgroundTag":"mark-not-supported","analyzedSha":"e2a1e27560a1e68840c34f031afca88b36096e30","analyzedAt":"2026-09-10T12:37:37.238Z","contentChangedAt":"2026-09-10T12:37:37.238Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}