AlexxIT/go2rtc · error
ivideon: wrong message type:
Error message
ivideon: wrong message type:
What it means
The ivideon Producer's receive loop (called from Start) parses WebSocket messages as JSON; every message must have a known 'type' field handled by the switch. When the server sends a message whose type does not match the expected values (e.g. not 'fragment' or the other handled types), the producer aborts with this error including the offending msg.Type. It indicates the server protocol deviates from what this client understands — often a protocol/version mismatch or corrupted/unexpected payload.
Solutions
- Log msg.Type to see what type the server actually sent and compare against handled types in pkg/ivideon/ivideon.go.
- Upgrade the library / check for protocol changes in the ivideon streaming API.
- Verify the stream/URL parameters are valid so the server doesn't respond with error messages.
- Inspect network path for proxies that could inject non-media messages.
Defensive patterns
Strategy: retry
Validate before calling
// ensure the stream URL/ID is reachable before starting the producer
conn, _, err := dialer.Dial(wsURL, nil)
if err != nil { return err } Try / catch
err := producer.Start()
if err != nil {
if strings.HasPrefix(err.Error(), "ivideon: wrong message type") {
// reconnect / upgrade client, possibly with backoff
return retryWithBackoff(producer.Start)
}
return err
} Prevention
- Keep the ivideon client library updated for protocol changes
- Validate stream IDs/URLs before opening the websocket
- Log unexpected msg.Type values to spot protocol drift early
- Avoid proxies that may inject error pages into the stream
When it happens
Trigger: Producer.Start() -> receive loop receives a websocket message whose JSON 'type' is not one of the handled types (e.g. an error/close or unknown control message from the ivideon server).
Common situations: Ivideon server protocol changed or client library is outdated; proxy returning an HTML/JSON error page instead of expected media messages; invalid stream ID causing the server to send an error-typed message.
Related errors
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/47f702c1894dd355.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/ivideon/ivideon.go:142
if err := p.conn.ReadJSON(&msg); err != nil {
return err
}
switch msg.Type {
case "stream-init", "metadata":
continue
case "fragment":
_, b, err := p.conn.ReadMessage()
if err != nil {
return err
}
p.Recv += len(b)
ch <- b
default:
return errors.New("ivideon: wrong message type: " + msg.Type)
}
}
}
func (p *Producer) probe() (err error) {
p.dem = &mp4.Demuxer{}
for {
var msg message
if err = p.conn.ReadJSON(&msg); err != nil {
return err
}
switch msg.Type {
case "metadata":
continue
case "stream-init":View on GitHub (pinned to c245815e75)