AlexxIT/go2rtc · error

gopro: wrong response:

Error message

gopro: wrong response: 

What it means

The gopro producer's command function performs an HTTP request to the camera and requires StatusCode == 200. Any other status (e.g. 500 when the camera is busy, 403 for unauthorized commands) produces this error with the HTTP status text appended, e.g. "gopro: wrong response: 500 Internal Server Error".

Solutions

  1. Retry the command with a short backoff — transient 5xx responses are common when the camera is busy or booting.
  2. Check the camera state (recording/streaming) before issuing commands that conflict with it.
  3. Verify Wi-Fi association and that the camera IP is correct; ping the camera's HTTP endpoint directly.
  4. Update camera firmware and library if a specific command consistently returns 4xx (endpoint changed).

Example fix

// before: single Dial attempt fails on transient 500
err := producer.Dial()
// after: retry with backoff
var err error
for i := 0; i < 5; i++ {
    if err = producer.Dial(); err == nil || !strings.Contains(err.Error(), "wrong response: 5") {
        break
    }
    time.Sleep(time.Duration(1<<i) * time.Second)
}
Defensive patterns

Strategy: retry

Validate before calling

// confirm the camera's HTTP API answers before commanding
resp, err := http.Get("http://" + cameraHost + "/gopro/camera/state")
if err != nil || resp.StatusCode != http.StatusOK {
    return errors.New("gopro HTTP API not ready")
}

Try / catch

var err error
for i := 0; i < 3; i++ {
    if err = producer.Dial(); err == nil || !strings.HasPrefix(err.Error(), "gopro: wrong response: 5") {
        break
    }
    time.Sleep(time.Duration(1<<i) * time.Second) // retry 5xx only
}

Prevention

When it happens

Trigger: Dial or worker sending a command to the GoPro while the camera is busy recording, powering off, or already streaming; sending commands over a weak Wi-Fi link where the camera's HTTP server returns 5xx; issuing commands before the camera's HTTP API is fully up.

Common situations: Connecting to a GoPro that is still booting; two clients issuing conflicting commands; camera firmware rejecting a command with 400/404 because the endpoint changed; Wi-Fi associated but the camera's HTTP server not yet reachable.

Related errors


AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07). Data as JSON: /api/errors/1cfb67106abda6ed. Report an issue: GitHub.

Appendix: source

Thrown at pkg/gopro/producer.go:86

	return
}

func (r *listener) Close() error {
	return r.conn.Close()
}

func (r *listener) command(api string) error {
	client := &http.Client{Timeout: 5 * time.Second}

	res, err := client.Get("http://" + r.host + ":8080" + api)
	if err != nil {
		return err
	}

	_ = res.Body.Close()

	if res.StatusCode != http.StatusOK {
		return errors.New("gopro: wrong response: " + res.Status)
	}

	return nil
}

func (r *listener) listen() (err error) {
	if r.conn, err = net.ListenPacket("udp4", ":8554"); err != nil {
		return
	}

	r.packets = make(chan []byte, 1024)
	go r.worker()

	return
}

func (r *listener) worker() {
	b := make([]byte, 1500)

View on GitHub (pinned to c245815e75)