{"record":{"id":"47f702c1894dd355","repo":"AlexxIT/go2rtc","slug":"ivideon-wrong-message-type","errorCode":null,"errorMessage":"ivideon: wrong message type: ","messagePattern":"ivideon: wrong message type: ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/ivideon/ivideon.go","lineNumber":142,"sourceCode":"\t\tif err := p.conn.ReadJSON(&msg); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tswitch msg.Type {\n\t\tcase \"stream-init\", \"metadata\":\n\t\t\tcontinue\n\n\t\tcase \"fragment\":\n\t\t\t_, b, err := p.conn.ReadMessage()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tp.Recv += len(b)\n\t\t\tch <- b\n\n\t\tdefault:\n\t\t\treturn errors.New(\"ivideon: wrong message type: \" + msg.Type)\n\t\t}\n\t}\n}\n\nfunc (p *Producer) probe() (err error) {\n\tp.dem = &mp4.Demuxer{}\n\n\tfor {\n\t\tvar msg message\n\t\tif err = p.conn.ReadJSON(&msg); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tswitch msg.Type {\n\t\tcase \"metadata\":\n\t\t\tcontinue\n\n\t\tcase \"stream-init\":","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/ivideon/ivideon.go#L124-L160","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure the stream URL/ID is reachable before starting the producer\nconn, _, err := dialer.Dial(wsURL, nil)\nif err != nil { return err }","typeGuard":null,"tryCatchPattern":"err := producer.Start()\nif err != nil {\n\tif strings.HasPrefix(err.Error(), \"ivideon: wrong message type\") {\n\t\t// reconnect / upgrade client, possibly with backoff\n\t\treturn retryWithBackoff(producer.Start)\n\t}\n\treturn err\n}","preventionTips":["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"],"tags":["websocket","protocol","ivideon","streaming"],"backgroundTag":"unexpected-response-shape","analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}