AlexxIT/go2rtc · error
ring: wrong query
Error message
ring: wrong query
What it means
Ring's Dial parses the connection query parameters and requires refresh_token, camera_id and device_id. If any of these is missing or empty it throws "ring: wrong query" before attempting any connection.
Solutions
- Include all three query params: refresh_token, camera_id and device_id
- Verify the refresh token is non-empty (a fresh valid Ring refresh token)
- URL-encode the query string properly so params are not dropped
Example fix
// before
conn.Dial("ring://ring.com?device_id=abc")
// after
conn.Dial("ring://ring.com?refresh_token=RT&camera_id=CAM1&device_id=abc") Defensive patterns
Strategy: validation
Validate before calling
u, _ := url.Parse(connStr)
q := u.Query()
for _, k := range []string{"refresh_token", "camera_id", "device_id"} {
if q.Get(k) == "" {
return fmt.Errorf("ring query missing %s", k)
}
} Try / catch
client, err := Dial(ctx, query)
if err != nil && err.Error() == "ring: wrong query" {
return fmt.Errorf("ring connection string malformed: %w", err)
} Prevention
- Build the query with url.Values so no param is silently dropped
- Validate connection strings at config load time
- Log which of the three params is missing in your own pre-check
When it happens
Trigger: Dialing a ring camera stream with a query string missing refresh_token, device_id, or camera_id — e.g. "?refresh_token=abc&device_id=xyz" (no camera_id) or an empty query entirely.
Common situations: Building the connection URL by hand and omitting a parameter; credentials/config where the camera_id was never filled in; snapshot mode URLs still requiring the base trio of params.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- either email/password or refresh_token is required
- ffmpeg: unsupported params:
- nest: wrong query
- onvif: wrong subtype
- ring: close
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/5f9bc25ce562aaa6.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/ring/client.go:39
dialogID string
connected core.Waiter
closed bool
}
func Dial(rawURL string) (*Client, error) {
u, err := url.Parse(rawURL)
if err != nil {
return nil, err
}
query := u.Query()
encodedToken := query.Get("refresh_token")
cameraID := query.Get("camera_id")
deviceID := query.Get("device_id")
_, isSnapshot := query["snapshot"]
if encodedToken == "" || deviceID == "" || cameraID == "" {
return nil, errors.New("ring: wrong query")
}
client := &Client{
dialogID: uuid.NewString(),
}
client.cameraID, err = strconv.Atoi(cameraID)
if err != nil {
return nil, fmt.Errorf("ring: invalid camera_id: %w", err)
}
refreshToken, err := url.QueryUnescape(encodedToken)
if err != nil {
return nil, fmt.Errorf("ring: invalid refresh token encoding: %w", err)
}
client.api, err = NewRestClient(RefreshTokenAuth{RefreshToken: refreshToken}, nil)
if err != nil {View on GitHub (pinned to c245815e75)