glanceapp/glance · error

unexpected status code %d when submitting challenge solution

Error message

unexpected status code %d when submitting challenge solution

What it means

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.

Source

Thrown at internal/glance/widget-reddit.go:446

		"solution":     {solution},
		"js_challenge": {"1"},
		"token":        {token},
	}
	request, err = http.NewRequest("GET", "https://www.reddit.com/?"+params.Encode(), nil)
	if err != nil {
		return "", err
	}

	setBrowserUserAgentHeader(request)

	response, err = redditHTTPClient.Do(request)
	if err != nil {
		return "", err
	}
	defer response.Body.Close()

	if response.StatusCode != http.StatusOK {
		return "", fmt.Errorf("unexpected status code %d when submitting challenge solution", response.StatusCode)
	}

	for _, cookie := range response.Cookies() {
		if cookie.Name == "loid" {
			return cookie.Value, nil
		}
	}

	return "", fmt.Errorf("no loid cookie found")
}

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Update Glance — solution-algorithm changes require a code fix upstream
  2. Reduce request frequency to the reddit widget or increase the update interval to avoid 429 rate limiting
  3. Move to a different egress IP if Reddit is rejecting challenges from yours
  4. Rely on the cached loid cookie fallback and retry later; the cookie is cached ~6 hours on success
Defensive patterns

Strategy: retry

Try / catch

if err != nil {
    if msg := err.Error(); strings.Contains(msg, "submitting challenge solution") {
        // 403 => solution algorithm changed (needs update); 429 => back off
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15). Data as JSON: /api/errors/0cedae58cbb795ca. Report an issue: GitHub.