{"record":{"id":"1cfb67106abda6ed","repo":"AlexxIT/go2rtc","slug":"gopro-wrong-response","errorCode":null,"errorMessage":"gopro: wrong response: ","messagePattern":"gopro: wrong response: ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gopro/producer.go","lineNumber":86,"sourceCode":"\treturn\n}\n\nfunc (r *listener) Close() error {\n\treturn r.conn.Close()\n}\n\nfunc (r *listener) command(api string) error {\n\tclient := &http.Client{Timeout: 5 * time.Second}\n\n\tres, err := client.Get(\"http://\" + r.host + \":8080\" + api)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_ = res.Body.Close()\n\n\tif res.StatusCode != http.StatusOK {\n\t\treturn errors.New(\"gopro: wrong response: \" + res.Status)\n\t}\n\n\treturn nil\n}\n\nfunc (r *listener) listen() (err error) {\n\tif r.conn, err = net.ListenPacket(\"udp4\", \":8554\"); err != nil {\n\t\treturn\n\t}\n\n\tr.packets = make(chan []byte, 1024)\n\tgo r.worker()\n\n\treturn\n}\n\nfunc (r *listener) worker() {\n\tb := make([]byte, 1500)","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/gopro/producer.go#L68-L104","documentation":"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\".","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry the command with a short backoff — transient 5xx responses are common when the camera is busy or booting.","Check the camera state (recording/streaming) before issuing commands that conflict with it.","Verify Wi-Fi association and that the camera IP is correct; ping the camera's HTTP endpoint directly.","Update camera firmware and library if a specific command consistently returns 4xx (endpoint changed)."],"exampleFix":"// before: single Dial attempt fails on transient 500\nerr := producer.Dial()\n// after: retry with backoff\nvar err error\nfor i := 0; i < 5; i++ {\n    if err = producer.Dial(); err == nil || !strings.Contains(err.Error(), \"wrong response: 5\") {\n        break\n    }\n    time.Sleep(time.Duration(1<<i) * time.Second)\n}","handlingStrategy":"retry","validationCode":"// confirm the camera's HTTP API answers before commanding\nresp, err := http.Get(\"http://\" + cameraHost + \"/gopro/camera/state\")\nif err != nil || resp.StatusCode != http.StatusOK {\n    return errors.New(\"gopro HTTP API not ready\")\n}","typeGuard":null,"tryCatchPattern":"var err error\nfor i := 0; i < 3; i++ {\n    if err = producer.Dial(); err == nil || !strings.HasPrefix(err.Error(), \"gopro: wrong response: 5\") {\n        break\n    }\n    time.Sleep(time.Duration(1<<i) * time.Second) // retry 5xx only\n}","preventionTips":["Wait for the camera to finish booting before sending commands.","Avoid issuing conflicting commands while recording or streaming.","Log the full status text from the error to distinguish 4xx (wrong command) from 5xx (busy)."],"tags":["gopro","http","camera","http-status"],"backgroundTag":"http-non-200-response","analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}