OpenFeign/feign · error · IOException
Mark not set
Error message
Mark not set
What it means
In CountingInputStream.reset (dropwizard-metrics5), the wrapped stream supports mark/reset and reset() was called, but mark() was never invoked first, so the recorded byte-count snapshot is the -1 sentinel and the underlying stream has no mark position to return to. This means reset() is being called without a prior mark() on this counting wrapper.
Solutions
- Call mark(int readlimit) on the stream before any reset()
- Guard reset() with markSupported() and a 'mark set' check, or track mark state explicitly
- Restructure reading logic so reset is only used after a valid mark
- If the wrapped stream never supports marking, avoid reset entirely
Example fix
// before in.reset(); // after in.mark(8192); // ... read ... in.reset();
Defensive patterns
Strategy: validation
Validate before calling
if (in.markSupported() && marked) { in.reset(); } Try / catch
try {
in.reset();
} catch (IOException e) {
// mark missing; re-acquire stream
} Prevention
- Call mark(readlimit) immediately after stream creation if reset will be used
- Do not assume CountingInputStream auto-marks
When it happens
Trigger: Calling reset() on feign.metrics5 CountingInputStream before ever calling mark(readlimit).
Common situations: Retry/replay code that resets the body stream without marking first.
Related errors
AI-assisted analysis of OpenFeign/feign@e2a1e27560 (2026-09-10).
Data as JSON: /api/errors/c20f5c5b623709f3.
Report an issue: GitHub.
Appendix: source
Thrown at dropwizard-metrics5/src/main/java/feign/metrics5/CountingInputStream.java:88
final long result = in.skip(n);
count += result;
return result;
}
@Override
public synchronized void mark(int readlimit) {
in.mark(readlimit);
mark = count;
// it's okay to mark even if mark isn't supported, as reset won't work
}
@Override
public synchronized void reset() throws IOException {
if (!in.markSupported()) {
throw new IOException("Mark not supported");
}
if (mark == -1) {
throw new IOException("Mark not set");
}
in.reset();
count = mark;
}
}
View on GitHub (pinned to e2a1e27560)