{"record":{"id":"9e805501d9615599","repo":"AlexxIT/go2rtc","slug":"failed-to-marshal-auth-request-w","errorCode":null,"errorMessage":"failed to marshal auth request: %w","messagePattern":"failed to marshal auth request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/ring/api.go","lineNumber":252,"sourceCode":"\t\t}\n\t} else {\n\t\tauthEmail, ok := c.auth.(EmailAuth)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"invalid auth type for email authentication\")\n\t\t}\n\t\tgrantData = map[string]string{\n\t\t\t\"grant_type\": \"password\",\n\t\t\t\"username\":   authEmail.Email,\n\t\t\t\"password\":   authEmail.Password,\n\t\t}\n\t}\n\n\tgrantData[\"client_id\"] = \"ring_official_android\"\n\tgrantData[\"scope\"] = \"client\"\n\n\tbody, err := json.Marshal(grantData)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal auth request: %w\", err)\n\t}\n\n\treq, err := http.NewRequest(\"POST\", oauthURL, bytes.NewReader(body))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"hardware_id\", c.hardwareID)\n\treq.Header.Set(\"User-Agent\", \"android:com.ringapp\")\n\treq.Header.Set(\"2fa-support\", \"true\")\n\tif twoFactorAuthCode != \"\" {\n\t\treq.Header.Set(\"2fa-code\", twoFactorAuthCode)\n\t}\n\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/ring/api.go#L234-L270","documentation":"json.Marshal of the OAuth grant_data map (password or refresh-token grant for the Ring API) failed, which practically only happens with unsupported value types in the map. Wraps the marshaling error; the auth request is never sent.","triggerScenarios":"Thrown at pkg/ring/api.go:252 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat as an internal bug: the grant data contains only strings and cannot normally fail to marshal","Report the issue with the grantData contents"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}