AlexxIT/go2rtc · error
stream not found:
Error message
stream not found:
What it means
In the RTMP server's tcpHandle, a CommandPlay intent looks up the stream by the RTMP app name via streams.Get. If no stream exists, the library returns "stream not found: <app>", refusing playback because there is no producer to feed the FLV consumer.
Solutions
- Configure the requested stream name in go2rtc.yaml streams section before playing
- Align the RTMP URL/stream key with an existing stream name
- Create the stream dynamically via the streams API before the RTMP play
- Check client logs for the exact app name and compare to configured names
Example fix
// before rtmp://host:1935/live/unknown_stream // after (go2rtc.yaml) streams: unknown_stream: rtsp://camera/...
Defensive patterns
Strategy: validation
Validate before calling
// Before RTMP play, verify the stream is configured curl -f http://host:1984/api/streams | grep <stream-name>
Try / catch
// Client side
if err := playRTMP(url); err != nil {
if strings.HasPrefix(err.Error(), "stream not found") {
log.Fatalf("configure stream %q in go2rtc first", appName)
}
} Prevention
- Ensure every RTMP playback name has a streams entry in go2rtc.yaml
- Use consistent naming between RTMP URLs and stream config
- Create streams via API before automated players start
When it happens
Trigger: An RTMP client (player) connects and sends play with an app/stream name that doesn't match any configured go2rtc stream; streams.Get(rtmpConn.App) returns nil.
Common situations: Publishing/playing to rtmp://host/live/name where "name" isn't configured in go2rtc.yaml, players using a different stream key than configured, or the stream being removed at runtime.
Related errors
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/02eb233c941655d3.
Report an issue: GitHub.
Appendix: source
Thrown at internal/rtmp/rtmp.go:82
}
}()
}
func tcpHandle(netConn net.Conn) error {
rtmpConn, err := rtmp.NewServer(netConn)
if err != nil {
return err
}
if err = rtmpConn.ReadCommands(); err != nil {
return err
}
switch rtmpConn.Intent {
case rtmp.CommandPlay:
stream := streams.Get(rtmpConn.App)
if stream == nil {
return errors.New("stream not found: " + rtmpConn.App)
}
cons := flv.NewConsumer()
if err = stream.AddConsumer(cons); err != nil {
return err
}
defer stream.RemoveConsumer(cons)
if err = rtmpConn.WriteStart(); err != nil {
return err
}
_, _ = cons.WriteTo(rtmpConn)
return nil
case rtmp.CommandPublish:View on GitHub (pinned to c245815e75)