AlexxIT/go2rtc · error
wrong status:
Error message
wrong status:
What it means
The image producer fetches a frame over TCP/HTTP and requires HTTP 200 OK. If the camera/source returns any other status code, Start (or the frame loop) aborts with 'wrong status: <status line>', embedding the server's response status text.
Solutions
- Check the status text in the error (e.g. '401 Unauthorized') and fix the corresponding cause: credentials, URL path, or camera state
- Verify the camera stream URL/path is correct by opening it in a browser or curl -i
- Add authentication to the outgoing request if the source requires it
- Handle redirects/HTTPS: if the camera serves TLS, use the https URL/scheme the library expects
- Retry with backoff if the status is transient (503 during camera reboot)
Example fix
// before
req, _ := http.NewRequest("GET", "http://camera/stream", nil)
// after (add auth for 401)
req, _ := http.NewRequest("GET", "http://camera/stream", nil)
req.SetBasicAuth(user, pass) Defensive patterns
Strategy: retry
Validate before calling
// preflight the source before wiring the producer
resp, err := http.Get(cameraURL)
if err != nil { return err }
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("camera source not ready: %s", resp.Status)
}
resp.Body.Close() Try / catch
err := producer.Start()
if err != nil {
var retriable = strings.Contains(err.Error(), "wrong status: 50") ||
strings.Contains(err.Error(), "wrong status: 429")
if retriable {
time.Sleep(2 * time.Second)
err = producer.Start()
}
return err
} Prevention
- Verify camera URL and credentials with curl -i before configuring
- Expect 401/404/503 and map them to auth/path/camera-state fixes
- Prefer HTTPS-capable sources to avoid redirect statuses
- Add retry-with-backoff around producer start for transient camera states
When it happens
Trigger: The HTTP request issued to the camera/MJPEG source returns a non-200 status — e.g. 401/403 for wrong credentials, 404 for a wrong stream URL path, 503 when the camera is rebooting or out of sessions, or 302 if the source redirects to HTTPS.
Common situations: Camera URL changed or wrong path; missing/basic-auth credentials in the request; too many concurrent RTSP-over-HTTP clients; camera firmware updating; HTTP source that actually requires HTTPS so it responds with a redirect or error.
Related errors
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/696f38eff8375df4.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/image/producer.go:69
pkt := &rtp.Packet{
Header: rtp.Header{Timestamp: core.Now90000()},
Payload: body,
}
c.Receivers[0].WriteRTP(pkt)
c.Recv += len(body)
req := c.res.Request
for !c.closed {
res, err := tcp.Do(req)
if err != nil {
return err
}
if res.StatusCode != http.StatusOK {
return errors.New("wrong status: " + res.Status)
}
body, err = io.ReadAll(res.Body)
if err != nil {
return err
}
c.Recv += len(body)
pkt = &rtp.Packet{
Header: rtp.Header{Timestamp: core.Now90000()},
Payload: body,
}
c.Receivers[0].WriteRTP(pkt)
}
return nil
}View on GitHub (pinned to c245815e75)