glanceapp/glance · error
no token found in challenge page
Error message
no token found in challenge page
What it means
Thrown by fetchRedditLoidCookie (internal/glance/widget-reddit.go:420) when the challenge page did match redditChallengePattern but the second regex, redditTokenPattern, found no token. Both the challenge string and the token must be extracted to build the solution URL (?solution=...&js_challenge=1&token=...); a page that contains the challenge markup but not the token means Reddit altered only the token part of the page (or the match in 120 is a false positive on unrelated HTML).
Source
Thrown at internal/glance/widget-reddit.go:420
if response.StatusCode != http.StatusOK {
return "", fmt.Errorf("unexpected status code %d when requesting challenge page", response.StatusCode)
}
challengeBody, err := io.ReadAll(response.Body)
if err != nil {
return "", err
}
challengeMatches := redditChallengePattern.FindSubmatch(challengeBody)
tokenMatches := redditTokenPattern.FindSubmatch(challengeBody)
if challengeMatches == nil {
return "", fmt.Errorf("no JS challenge found")
}
if tokenMatches == nil {
return "", fmt.Errorf("no token found in challenge page")
}
challengeStr := string(challengeMatches[1])
token := string(tokenMatches[1])
solution := challengeStr + challengeStr // the JS does: e + e
params := url.Values{
"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)
View on GitHub (pinned to 91324e8de7)
Solutions
- Update Glance to the latest version (token/challenge regexes are updated together when Reddit changes)
- Verify with curl -A <browser-UA> https://www.reddit.com/ that the challenge page still contains both the challenge and token fields
- Try from a different IP/network to exclude block pages
- If a cached loid cookie exists, wait for network conditions to change — Glance reuses the cached value
Defensive patterns
Strategy: retry
Try / catch
if err != nil && strings.Contains(err.Error(), "no token found in challenge page") {
// same class as 'no JS challenge found': page-shape drift; retry later
} Prevention
- Update Glance when Reddit changes its challenge page
- Rely on the ~6h cached loid cookie window
- Test egress path with curl using a browser User-Agent
When it happens
Trigger: The 200 response body contains something matching redditChallengePattern but nothing matching redditTokenPattern: partial Reddit page redesign where the token moved, a truncated response body (connection reset mid-read is a different error, but truncated HTML from a proxy is not), or the challenge pattern matching stale/unrelated markup.
Common situations: Reddit A/B-testing a new challenge page variant, old Glance version after a partial Reddit change, proxies or middleboxes stripping script blocks containing the token.
Related errors
- no JS challenge found
- no loid cookie found
- could not solve reddit challenge
- unexpected status code %d when submitting challenge solution
- subreddit is required
AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15).
Data as JSON: /api/errors/8ea73d263fa248a8.
Report an issue: GitHub.