{"record":{"id":"0cedae58cbb795ca","repo":"glanceapp/glance","slug":"unexpected-status-code-d-when-submitting-challeng","errorCode":null,"errorMessage":"unexpected status code %d when submitting challenge solution","messagePattern":"unexpected status code (.+?) when submitting challenge solution","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/glance/widget-reddit.go","lineNumber":446,"sourceCode":"\t\t\"solution\":     {solution},\n\t\t\"js_challenge\": {\"1\"},\n\t\t\"token\":        {token},\n\t}\n\trequest, err = http.NewRequest(\"GET\", \"https://www.reddit.com/?\"+params.Encode(), nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsetBrowserUserAgentHeader(request)\n\n\tresponse, err = redditHTTPClient.Do(request)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer response.Body.Close()\n\n\tif response.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"unexpected status code %d when submitting challenge solution\", response.StatusCode)\n\t}\n\n\tfor _, cookie := range response.Cookies() {\n\t\tif cookie.Name == \"loid\" {\n\t\t\treturn cookie.Value, nil\n\t\t}\n\t}\n\n\treturn \"\", fmt.Errorf(\"no loid cookie found\")\n}\n","sourceCodeStart":428,"sourceCodeEnd":457,"githubUrl":"https://github.com/glanceapp/glance/blob/91324e8de762702e97b0ac5c8e36271d644d8642/internal/glance/widget-reddit.go#L428-L457","documentation":"Thrown by fetchRedditLoidCookie (internal/glance/widget-reddit.go:446) when the follow-up GET to https://www.reddit.com/?solution=...&js_challenge=1&token=... returns a non-200 status. This is Reddit rejecting (or failing to accept) the solved challenge — typically 403 when the computed solution (challengeStr + challengeStr, mimicking the JS 'e + e') is wrong because Reddit changed the solution algorithm, or 429 when rate-limited.","triggerScenarios":"Submitting the challenge solution returns 403 (wrong solution because the JS now computes something other than e+e), 429 (too many challenge attempts from this IP), 5xx (Reddit-side failure), or a redirect chain ending in a non-200 because the token was single-use and already consumed.","commonSituations":"Glance instances on shared/datacenter IPs repeatedly solving challenges and hitting rate limits; Reddit changing the challenge verification logic so the hardcoded 'e + e' solution no longer passes; expired tokens due to clock skew or slow replay.","solutions":["Update Glance — solution-algorithm changes require a code fix upstream","Reduce request frequency to the reddit widget or increase the update interval to avoid 429 rate limiting","Move to a different egress IP if Reddit is rejecting challenges from yours","Rely on the cached loid cookie fallback and retry later; the cookie is cached ~6 hours on success"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil {\n    if msg := err.Error(); strings.Contains(msg, \"submitting challenge solution\") {\n        // 403 => solution algorithm changed (needs update); 429 => back off\n    }\n}","preventionTips":["Space out reddit widget refreshes to avoid 429","Update Glance when the solution algorithm changes upstream","Keep a cached loid cookie as fallback"],"tags":["reddit","anti-bot","http-status","rate-limit"],"backgroundTag":null,"analyzedSha":"91324e8de762702e97b0ac5c8e36271d644d8642","analyzedAt":"2026-08-15T14:12:54.279Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}