AlexxIT/go2rtc · error

streams: unknown error

Error message

streams: unknown error

What it means

Catch-all returned by formatError in AddConsumer when codec negotiation failed but the underlying error matched none of the known cases (step 3 after specific cases are exhausted). It means the exact cause could not be classified, so the real reason must be dug out of logs or the peer connection state.

Solutions

  1. Inspect preceding log lines and the WebRTC/RTSP peer state to find the true negotiation failure
  2. Retry AddConsumer against a fresh producer connection
  3. Report the case upstream so formatError can classify it
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/streams/add_consumer.go:155 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07). Data as JSON: /api/errors/2ab2f3d7b500da5e. Report an issue: GitHub.

Appendix: source

Thrown at internal/streams/add_consumer.go:155

				for _, codec := range media.Codecs {
					prod = appendString(prod, media.Kind+":"+codec.PrintName())
				}
			}
		}

		for _, media := range consMedias {
			if media.Direction == core.DirectionSendonly {
				for _, codec := range media.Codecs {
					cons = appendString(cons, media.Kind+":"+codec.PrintName())
				}
			}
		}

		return errors.New("streams: codecs not matched: " + prod + " => " + cons)
	}

	// 3. Return unknown error
	return errors.New("streams: unknown error")
}

func appendString(s, elem string) string {
	if strings.Contains(s, elem) {
		return s
	}
	if len(s) == 0 {
		return elem
	}
	return s + ", " + elem
}

View on GitHub (pinned to c245815e75)