{"record":{"id":"edae5d8ff309e98f","repo":"AlexxIT/go2rtc","slug":"get-track-from-none-state","errorCode":null,"errorMessage":"get track from none state","messagePattern":"get track from none state","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/streams/producer.go","lineNumber":90,"sourceCode":"}\n\nfunc (p *Producer) GetMedias() []*core.Media {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\n\tif p.conn == nil {\n\t\treturn nil\n\t}\n\n\treturn p.conn.GetMedias()\n}\n\nfunc (p *Producer) GetTrack(media *core.Media, codec *core.Codec) (*core.Receiver, error) {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\n\tif p.state == stateNone {\n\t\treturn nil, errors.New(\"get track from none state\")\n\t}\n\n\tfor _, track := range p.receivers {\n\t\tif track.Codec == codec {\n\t\t\treturn track, nil\n\t\t}\n\t}\n\n\ttrack, err := p.conn.GetTrack(media, codec)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp.receivers = append(p.receivers, track)\n\n\tif p.state == stateMedias {\n\t\tp.state = stateTracks\n\t}","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/internal/streams/producer.go#L72-L108","documentation":"Producer.GetTrack's state-machine guard: the producer is still in stateNone (its medias have not been probed yet), so requesting a track is premature. GetTrack requires the producer to have advanced at least to stateMedias before tracks can be matched or fetched from the underlying connection.","triggerScenarios":"Thrown at internal/streams/producer.go:90 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call Start (or wait for medias to be probed) on the producer before GetTrack","Check GetMedias() returns non-nil before requesting tracks","Use WaitMedias-style synchronization if callers race the probe"],"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"}