{"record":{"id":"016e6fe17ebe8f6c","repo":"AlexxIT/go2rtc","slug":"wrong-media-v","errorCode":null,"errorMessage":"wrong media: %v","messagePattern":"wrong media: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/rtsp/client.go","lineNumber":282,"sourceCode":"\n\t\tport := conn1.LocalAddr().(*net.UDPAddr).Port\n\t\ttransport = fmt.Sprintf(\"RTP/AVP;unicast;client_port=%d-%d\", port, port+1)\n\t} else {\n\t\t// try to use media position as channel number\n\t\tfor i, m := range c.Medias {\n\t\t\tif m.Equal(media) {\n\t\t\t\ttransport = fmt.Sprintf(\n\t\t\t\t\t// i   - RTP (data channel)\n\t\t\t\t\t// i+1 - RTCP (control channel)\n\t\t\t\t\t\"RTP/AVP/TCP;unicast;interleaved=%d-%d\", i*2, i*2+1,\n\t\t\t\t)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif transport == \"\" {\n\t\treturn 0, fmt.Errorf(\"wrong media: %v\", media)\n\t}\n\n\trawURL := media.ID // control\n\tif !strings.Contains(rawURL, \"://\") {\n\t\trawURL = c.URL.String()\n\t\t// prefix check for https://github.com/AlexxIT/go2rtc/issues/1236\n\t\tif !strings.HasSuffix(rawURL, \"/\") && !strings.HasPrefix(media.ID, \"/\") {\n\t\t\trawURL += \"/\"\n\t\t}\n\t\trawURL += media.ID\n\t}\n\ttrackURL, err := urlParse(rawURL)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treq := &tcp.Request{\n\t\tMethod: MethodSetup,","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/rtsp/client.go#L264-L300","documentation":"SetupMedia could not build a Transport header for the requested media: for TCP mode the media was not found among the session's negotiated Medias (so no interleaved channel pair could be assigned). Returns no channel; the media must match one from DESCRIBE.","triggerScenarios":"Thrown at pkg/rtsp/client.go:282 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run Describe first so Medias is populated, and pass one of its tracks","Re-fetch the session description if the media list is stale after reconnect"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}