{"record":{"id":"6820ec7f2cc85a96","repo":"AlexxIT/go2rtc","slug":"multipart-no-receivers","errorCode":null,"errorMessage":"multipart: no receivers","messagePattern":"multipart: no receivers","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/kasa/producer.go","lineNumber":85,"sourceCode":"\n\tprod := &Producer{\n\t\tConnection: core.Connection{\n\t\t\tID:         core.NewID(),\n\t\t\tFormatName: \"kasa\",\n\t\t\tProtocol:   \"http\",\n\t\t\tTransport:  rd,\n\t\t},\n\t\trd: core.NewReadBuffer(rd),\n\t}\n\tif err = prod.probe(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn prod, nil\n}\n\nfunc (c *Producer) Start() error {\n\tif len(c.Receivers) == 0 {\n\t\treturn errors.New(\"multipart: no receivers\")\n\t}\n\n\tvar video, audio *core.Receiver\n\n\tfor _, receiver := range c.Receivers {\n\t\tswitch receiver.Codec.Name {\n\t\tcase core.CodecH264:\n\t\t\tvideo = receiver\n\t\tcase core.CodecPCMU:\n\t\t\taudio = receiver\n\t\t}\n\t}\n\n\tfor {\n\t\theader, body, err := mpjpeg.Next(c.reader)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/kasa/producer.go#L67-L103","documentation":"Producer.Start (labeled with the 'multipart:' prefix despite living in pkg/kasa) requires at least one receiver configured before it can begin producing. If the Producer's Receivers slice is empty, it refuses to start and returns this error. It is a configuration precondition check, not a runtime/network failure.","triggerScenarios":"Calling Producer.Start() on a Producer constructed without appending any *core.Receiver to c.Receivers (e.g. no video/audio receivers were configured).","commonSituations":"Forgot to wire receivers after creating the Producer; receivers were attached to the wrong Producer instance; config parsing skipped media entries so none were added.","solutions":["Create at least one core.Receiver (video and/or audio) and append it to Producer.Receivers before calling Start().","Verify the code path that builds the Producer actually registers receivers (check for skipped media config entries).","Log len(prod.Receivers) before Start() to confirm configuration is applied."],"exampleFix":"// before\nprod := kasa.NewProducer(...)\nerr := prod.Start() // panic-free but fails: multipart: no receivers\n// after\nrecv := core.NewReceiver(core.FormatH264, nil)\nprod.Receivers = append(prod.Receivers, recv)\nerr := prod.Start()","handlingStrategy":"validation","validationCode":"if len(prod.Receivers) == 0 {\n\treturn errors.New(\"cannot start producer: no receivers configured\")\n}\nerr := prod.Start()","typeGuard":"func hasReceivers(p *kasa.Producer) bool { return p != nil && len(p.Receivers) > 0 }","tryCatchPattern":"if err := prod.Start(); err != nil {\n\tif err.Error() == \"multipart: no receivers\" {\n\t\treturn fmt.Errorf(\"producer misconfigured: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Always append at least one core.Receiver before Start()","Centralize producer construction in a helper that wires receivers","Unit-test producer setup to catch empty receiver lists","Log len(Receivers) at configuration time"],"tags":["configuration","kasa","mediamtx","receivers"],"backgroundTag":"empty-required-field","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"}