AlexxIT/go2rtc · error
probe reader overflow
Error message
probe reader overflow
What it means
pkg/core/readbuffer.go:63 implements a probe reader that records every byte it reads into an internal buffer, capped at r.BufferSize. When a single Read would push the recorded buffer beyond BufferSize (len(r.buf)+n > r.BufferSize), it refuses the read and returns "probe reader overflow". This is a library-internal invariant: the probe detection logic expected media probing to finish within a bounded number of bytes.
Solutions
- Increase BufferSize on the probe reader so it can hold enough bytes for your container's headers.
- Verify the media source is actually the expected format (a garbage/garbled stream may never be recognized).
- Check that the source produces a proper probeable stream (correct container, valid headers).
- If probing an unusual source (e.g. raw streams), bypass probing by declaring the codec explicitly.
Example fix
// before core.NewProbeReader(rs, 4096) // after: larger probe window for sources with long headers core.NewProbeReader(rs, 512*1024)
Defensive patterns
Strategy: validation
Validate before calling
// ensure the probe window is large enough before probing
if probeReader.BufferSize < 512*1024 {
probeReader = core.NewProbeReader(rs, 512*1024)
} Try / catch
n, err := probeReader.Read(p)
if err != nil && err.Error() == "probe reader overflow" {
return fmt.Errorf("media source exceeded probe window (%w); enlarge BufferSize or check source format", err)
} Prevention
- Size BufferSize generously for containers with long headers
- Only probe sources expected to be valid media
- Declare codecs explicitly for raw/non-probeable streams
- Unit-test probe limits with your real source types
When it happens
Trigger: Any Read on the probe reader whose accumulated bytes plus the incoming chunk exceed r.BufferSize; triggered from TestReadSeeker or media probing when the source streams more data than the probe window before the format could be identified.
Common situations: Probing a media source with very large headers or no early recognizable format signature; misconfigured BufferSize too small for the container format; a source that never yields probeable data so the buffer fills to the cap.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/19db9441a89b8766.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/core/readbuffer.go:63
// if buffer not empty - read from it
if r.pos < len(r.buf) {
n = copy(p, r.buf[r.pos:])
r.pos += n
return
}
// with negative buffer - empty it and read as usual
if r.BufferSize < 0 {
r.BufferSize = BufferDisable
r.buf = nil
r.pos = 0
return r.Reader.Read(p)
}
n, err = r.Reader.Read(p)
if len(r.buf)+n > r.BufferSize {
return 0, errors.New("probe reader overflow")
}
r.buf = append(r.buf, p[:n]...)
r.pos += n
return
}
func (r *ReadBuffer) Close() error {
if closer, ok := r.Reader.(io.Closer); ok {
return closer.Close()
}
return nil
}
func (r *ReadBuffer) Seek(offset int64, whence int) (int64, error) {
var pos int
switch whence {
case io.SeekStart:
pos = int(offset)View on GitHub (pinned to c245815e75)