{"record":{"id":"034c191d7551d7f8","repo":"AlexxIT/go2rtc","slug":"wrong-user-pass","errorCode":null,"errorMessage":"wrong user/pass","messagePattern":"wrong user/pass","errorType":"validation","errorClass":null,"httpStatus":401,"severity":"error","filePath":"pkg/rtsp/client.go","lineNumber":136,"sourceCode":"\t\t}\n\n\t\treq.URL = c.URL // because path was changed\n\n\t\treturn c.Do(req)\n\n\tcase http.StatusUnauthorized:\n\t\tswitch c.auth.Method {\n\t\tcase tcp.AuthNone:\n\t\t\tif c.auth.ReadNone(res) {\n\t\t\t\treturn c.Do(req)\n\t\t\t}\n\t\t\treturn nil, errors.New(\"user/pass not provided\")\n\t\tcase tcp.AuthUnknown:\n\t\t\tif c.auth.Read(res) {\n\t\t\t\treturn c.Do(req)\n\t\t\t}\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"wrong user/pass\")\n\t\t}\n\t}\n\n\treturn res, fmt.Errorf(\"wrong response on %s\", req.Method)\n}\n\nfunc (c *Conn) Options() error {\n\treq := &tcp.Request{Method: MethodOptions, URL: c.URL}\n\n\tres, err := c.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif val := res.Header.Get(\"Content-Base\"); val != \"\" {\n\t\tc.URL, err = urlParse(val)\n\t\tif err != nil {\n\t\t\treturn err","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/rtsp/client.go#L118-L154","documentation":"The RTSP client sent a request and got a 401 Unauthorized response, and it cannot retry with new auth material. The auth layer already holds a concrete credential method (Basic or Digest), re-sent the request with those credentials, and the server rejected them again, so Do() aborts with \"wrong user/pass\". It means the username/password embedded in the RTSP URL (or set via auth) is incorrect or does not match the server's auth scheme.","triggerScenarios":"Calling client methods Options/Describe/Announce/Record/SetupMedia (which all route through Do) with an RTSP URL whose credentials the camera/server rejects: the first request returns 401, credentials from the URL are applied (auth method is no longer AuthUnknown/AuthNone), and the retried request returns 401 again.","commonSituations":"Typo or stale password in an RTSP URL like rtsp://user:pass@camera/stream; camera credentials changed after a firmware update or password reset; special characters in the password not URL-encoded in the URL; account locked on the camera; using credentials from a different device.","solutions":["Check the username/password in the RTSP URL and verify them against the camera/server settings (e.g. log in to the camera web UI with the same credentials).","URL-encode special characters in the password (e.g. @ -> %40, : -> %3A) inside the RTSP URL.","Reset the camera credentials to a known value and update the URL.","Test the URL with an independent tool (ffplay/vlc) to confirm the credentials work outside this library.","If the server requires an auth scheme the library's tcp.Auth cannot parse, check the server's Www-Authenticate header and its configuration."],"exampleFix":"// before\nclient, _ := rtsp.Dial(\"rtsp://admin:p@ss:word@192.168.1.10/stream\")\n// after (URL-encode special chars)\nclient, _ := rtsp.Dial(\"rtsp://admin:p%40ss%3Aword@192.168.1.10/stream\")","handlingStrategy":"try-catch","validationCode":"u, _ := url.Parse(rtspURL)\nif u.User == nil || u.User.Username() == \"\" {\n    return fmt.Errorf(\"RTSP URL must include credentials: %s\", rtspURL)\n}","typeGuard":null,"tryCatchPattern":"res, err := client.Describe()\nif err != nil && strings.Contains(err.Error(), \"wrong user/pass\") {\n    // prompt user for correct credentials / fail fast with clear message\n}","preventionTips":["Always embed URL-encoded credentials in the RTSP URL (url.UserPassword).","Verify camera credentials with ffplay/VLC before wiring into the app.","Update URLs whenever camera passwords change.","Log the host (never the password) when this error occurs to speed up diagnosis."],"tags":["rtsp","authentication","network","credentials"],"backgroundTag":"authentication-required","analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}