{"record":{"id":"97a2a68626f75fa5","repo":"m1k1o/neko","slug":"webrtc-stream-not-found","errorCode":null,"errorMessage":"webrtc stream not found","messagePattern":"webrtc stream not found","errorType":"error_code","errorClass":"ErrWebRTCStreamNotFound","httpStatus":null,"severity":"error","filePath":"server/pkg/types/webrtc.go","lineNumber":12,"sourceCode":"package types\n\nimport (\n\t\"errors\"\n\n\t\"github.com/pion/webrtc/v4\"\n)\n\nvar (\n\tErrWebRTCDataChannelNotFound = errors.New(\"webrtc data channel not found\")\n\tErrWebRTCConnectionNotFound  = errors.New(\"webrtc connection not found\")\n\tErrWebRTCStreamNotFound      = errors.New(\"webrtc stream not found\")\n)\n\ntype ICEServer struct {\n\tURLs       []string `mapstructure:\"urls\"       json:\"urls\"`\n\tUsername   string   `mapstructure:\"username\"   json:\"username,omitempty\"`\n\tCredential string   `mapstructure:\"credential\" json:\"credential,omitempty\"`\n}\n\ntype PeerVideo struct {\n\tDisabled bool   `json:\"disabled\"`\n\tID       string `json:\"id\"`\n\tVideo    string `json:\"video\"` // TODO: Remove this, used for compatibility with old clients.\n\tAuto     bool   `json:\"auto\"`\n}\n\ntype PeerVideoRequest struct {\n\tDisabled *bool           `json:\"disabled,omitempty\"`\n\tSelector *StreamSelector `json:\"selector,omitempty\"`","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/m1k1o/neko/blob/b0f01cedea68893e85a3fd852c0521238c285695/server/pkg/types/webrtc.go#L1-L30","documentation":"ErrWebRTCStreamNotFound is a sentinel error in the neko types package indicating that a stream (video pipeline/stream source) referenced by a WebRTC peer does not exist. It is returned by estimatorReader and SetVideo when the requested stream id/selector cannot be resolved to an active stream on the server.","triggerScenarios":"SetVideo(PeerVideoRequest) with a stream selector/video id that has no matching active stream; estimatorReader reading statistics for a stream that already closed; requesting video before the capture pipeline started.","commonSituations":"Client UI cached a stale list of streams; the host stopped/shut down the stream while viewers tried to switch; typos or outdated IDs in PeerVideoRequest.Video (legacy compatibility field); config choosing a video pipeline/device that isn't present (e.g. headless server without X/display).","solutions":["Verify the requested stream id/selector against the server's current stream list before calling SetVideo.","Check that the server's capture pipeline (Xorg/display/device config) is running and exposing the expected stream.","Refresh the client's stream list and retry with a valid id; stop using the legacy 'video' field if possible.","Recreate the peer/stream if it was destroyed mid-session.","Inspect server logs for capture-pipeline startup errors that leave no streams registered."],"exampleFix":"// before\npeer.SetVideo(types.PeerVideoRequest{Selector: &sel}) // ErrWebRTCStreamNotFound for stale id\n// after\nif !streams.Exists(sel.ID) {\n    sel.ID = defaultStreamID // refresh from server's stream list\n}\npeer.SetVideo(types.PeerVideoRequest{Selector: &sel})","handlingStrategy":"validation","validationCode":"// resolve the stream selector against live streams first\nif !streamRegistry.Has(selector.ID) {\n    return fmt.Errorf(\"stream %q not available\", selector.ID)\n}","typeGuard":"func StreamValid(sel types.StreamSelector, known []types.StreamSelector) bool {\n    for _, k := range known {\n        if k.ID == sel.ID { return true }\n    }\n    return false\n}","tryCatchPattern":"if err := peer.SetVideo(req); err != nil {\n    if errors.Is(err, types.ErrWebRTCStreamNotFound) {\n        // refresh stream list and retry with a valid id\n        return\n    }\n    return err\n}","preventionTips":["Refresh stream lists on host changes / OnHostChanged events.","Migrate off the legacy PeerVideo.Video string field.","Verify the capture pipeline (display/device) starts before clients connect.","Subscribe to server stream lifecycle events instead of caching ids."],"tags":["webrtc","stream","not-found","video","go"],"backgroundTag":"stream-not-found","analyzedSha":"b0f01cedea68893e85a3fd852c0521238c285695","analyzedAt":"2026-09-01T10:35:56.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}