AlexxIT/go2rtc · error
nest: failed to generate rtsp url
Error message
nest: failed to generate rtsp url
What it means
GenerateRtspStream (pkg/nest/api.go:375) got a 200 response but the decoded results contain no "rtspUrl" key in the streamUrls map. The library treats a missing RTSP URL as a failed stream generation even though the HTTP call succeeded.
Solutions
- Confirm the specific camera model supports RTSP streaming via the SDM API (many battery/doorbell devices do not).
- Log the full resv.Results payload to see what keys were actually returned and adapt parsing.
- Fall back to WebRTC streaming (ExchangeSDP path) if RTSP is unsupported for the device.
- Check for Nest API changelog updates that may have renamed or moved the streamUrls.rtspUrl field.
Example fix
// before: assuming rtspUrl always exists
url, err := api.GenerateRtspStream(projectID, deviceID)
// after: validate device support and handle absence
device, _ := sdm.GetDevice(deviceID)
if !device.SupportsRtsp() { return useWebRtc(device) }
url, err := api.GenerateRtspStream(projectID, deviceID) Defensive patterns
Strategy: fallback
Validate before calling
device, err := sdmClient.GetDevice(ctx, deviceID)
if err != nil { return err }
if !device.Traits["sdm.devices.traits.CameraLiveStream"].SupportsRtsp { return useWebRtcFallback(deviceID) } Type guard
func hasRtspUrl(results struct{ StreamURLs map[string]string }) bool {
u, ok := results.StreamURLs["rtspUrl"]
return ok && u != ""
} Try / catch
url, err := api.GenerateRtspStream(projectID, deviceID)
if err != nil && strings.Contains(err.Error(), "failed to generate rtsp url") {
return startWebRtcStream(deviceID) // device likely lacks RTSP
}
if err != nil { return err } Prevention
- Check the device's CameraLiveStream trait/supportedProtocols before choosing RTSP.
- Log the full generate response body when this error occurs to capture the actual shape.
- Implement a WebRTC (ExchangeSDP) fallback path for non-RTSP cameras.
- Watch the Nest SDM API changelog for streamUrls field changes.
When it happens
Trigger: Nest returns 200 with a streamUrls map that lacks the "rtspUrl" entry — e.g. the camera does not support RTSP, the SDM response shape changed, or the command silently failed with an empty results payload.
Common situations: Doorbell or battery cameras that don't expose RTSP; Nest API contract/field changes; devices streaming via WebRTC only; partially successful command responses with empty streamUrls.
Related errors
- nest: tried to stop rtsp stream without a project or device…
- ivideon: can't get live_stream
- no audio
- no video
- exec: rtsp module disabled
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/5a27c74948a91e03.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/nest/api.go:375
if res.StatusCode != 200 {
return "", errors.New("nest: wrong status: " + res.Status)
}
var resv struct {
Results struct {
StreamURLs map[string]string `json:"streamUrls"`
StreamExtensionToken string `json:"streamExtensionToken"`
StreamToken string `json:"streamToken"`
ExpiresAt time.Time `json:"expiresAt"`
} `json:"results"`
}
if err = json.NewDecoder(res.Body).Decode(&resv); err != nil {
return "", err
}
if _, ok := resv.Results.StreamURLs["rtspUrl"]; !ok {
return "", errors.New("nest: failed to generate rtsp url")
}
a.StreamProjectID = projectID
a.StreamDeviceID = deviceID
a.StreamToken = resv.Results.StreamToken
a.StreamExtensionToken = resv.Results.StreamExtensionToken
a.StreamExpiresAt = resv.Results.ExpiresAt
return resv.Results.StreamURLs["rtspUrl"], nil
}
func (a *API) StopRTSPStream() error {
if a.StreamProjectID == "" || a.StreamDeviceID == "" {
return errors.New("nest: tried to stop rtsp stream without a project or device ID")
}
var reqv struct {
Command string `json:"command"`View on GitHub (pinned to c245815e75)