{"record":{"id":"2500e8c1a067d014","repo":"AlexxIT/go2rtc","slug":"producer-without-tracks","errorCode":null,"errorMessage":"producer without tracks","messagePattern":"producer without tracks","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/homekit/producer.go","lineNumber":112,"sourceCode":"\t\t{\n\t\t\tKind:      core.KindVideo,\n\t\t\tDirection: core.DirectionRecvonly,\n\t\t\tCodecs: []*core.Codec{\n\t\t\t\t{\n\t\t\t\t\tName:        core.CodecJPEG,\n\t\t\t\t\tClockRate:   90000,\n\t\t\t\t\tPayloadType: core.PayloadTypeRAW,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\treturn c.Medias\n}\n\nfunc (c *Client) Start() error {\n\tif c.Receivers == nil {\n\t\treturn errors.New(\"producer without tracks\")\n\t}\n\n\tif c.Receivers[0].Codec.Name == core.CodecJPEG {\n\t\treturn c.startMJPEG()\n\t}\n\n\tvideoTrack := c.trackByKind(core.KindVideo)\n\tvideoCodec := trackToVideo(videoTrack, &c.videoConfig.Codecs[0], c.MaxWidth, c.MaxHeight)\n\n\taudioTrack := c.trackByKind(core.KindAudio)\n\taudioCodec := trackToAudio(audioTrack, &c.audioConfig.Codecs[0])\n\n\tc.videoSession = &srtp.Session{Local: c.srtpEndpoint()}\n\tc.audioSession = &srtp.Session{Local: c.srtpEndpoint()}\n\n\tvar err error\n\tc.stream, err = camera.NewStream(c.hap, videoCodec, audioCodec, c.videoSession, c.audioSession, c.Bitrate)\n\tif err != nil {","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/homekit/producer.go#L94-L130","documentation":"Client.Start checks that the Receivers slice is populated before starting playback; the (misleadingly named) 'producer without tracks' error means the client has no receivers/tracks configured, so there is nothing to start. The library refuses to start a client with an empty media configuration.","triggerScenarios":"Calling Start() on a homekit Client constructed without adding any receivers/tracks (e.g. Receivers nil because no stream/codec was negotiated or configured), or after a failed negotiation that left Receivers unset.","commonSituations":"Streaming a camera to HomeKit where the session was never properly negotiated; wiring a Client before codecs/receivers were assigned; a code path that skips receiver setup for unsupported codecs.","solutions":["Ensure receivers/tracks are configured on the Client before calling Start() (populate Client.Receivers, e.g. via negotiation or explicit setup)","Verify the upstream negotiation (SDP/camera stream setup) succeeded and returned at least one receiver","Check that Medias/codecs are defined so receiver initialization code actually runs","Guard the Start() call with a check like if client.Receivers == nil || len(client.Receivers) == 0 { configure first }"],"exampleFix":"// before\nclient, _ := homekit.NewClient(...)\nerr := client.Start() // panics into 'producer without tracks'\n// after\nclient, _ := homekit.NewClient(...)\nif len(client.GetMedias()) == 0 {\n    return errors.New(\"no media configured for homekit client\")\n}\nerr := client.Start()","handlingStrategy":"validation","validationCode":"if client.Receivers == nil || len(client.Receivers) == 0 {\n    return errors.New(\"cannot start homekit client: no receivers configured\")\n}\nif err := client.Start(); err != nil { return err }","typeGuard":"func hasReceivers(c *homekit.Client) bool {\n    return c != nil && c.Receivers != nil && len(c.Receivers) > 0\n}","tryCatchPattern":"if err := client.Start(); err != nil {\n    if strings.Contains(err.Error(), \"producer without tracks\") {\n        return fmt.Errorf(\"homekit client has no receivers/tracks; run negotiation first: %w\", err)\n    }\n    return err\n}","preventionTips":["Only call Start() after a successful track/receiver negotiation","Check GetMedias() returns at least one media before starting","Log negotiation results so a silently empty receiver list is caught early"],"tags":["homekit","streaming","invalid-state","client-init"],"backgroundTag":"invalid-state-transition","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"}