glanceapp/glance · error
no JS challenge found
Error message
no JS challenge found
What it means
Thrown by fetchRedditLoidCookie (internal/glance/widget-reddit.go:416) when the page returned by https://www.reddit.com/ with status 200 does not contain the markup matched by redditChallengePattern. Glance solves Reddit's anti-bot JS challenge by regex-extracting the challenge string from the HTML; if Reddit changes the challenge page structure, stops issuing challenges, or serves a different page (block page, redirect target, localized variant), the pattern finds nothing and this error fires.
Source
Thrown at internal/glance/widget-reddit.go:416
if err != nil {
return "", err
}
defer response.Body.Close()
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 "", errView on GitHub (pinned to 91324e8de7)
Solutions
- Update Glance to the latest release — challenge regex fixes land frequently whenever Reddit changes the page
- Run from a residential IP or different network to rule out Reddit serving a block page instead of the challenge
- Check if a cached loid cookie still exists (Glance falls back to it for up to 6 hours); the widget only fully fails when there is no cache
- Report the issue upstream with your Glance version so redditChallengePattern can be updated
Defensive patterns
Strategy: retry
Try / catch
// Go: treat as transient; Glance already falls back to a cached loid cookie.
loid, err := getRedditLoid()
if err != nil {
if strings.Contains(err.Error(), "no JS challenge found") {
// Reddit page variant or block page; retry later, use cache
}
} Prevention
- Keep Glance updated since Reddit challenge changes require regex fixes
- Avoid datacenter IPs that Reddit serves block pages to
- Cache the loid cookie so brief challenge changes degrade gracefully
When it happens
Trigger: GET https://www.reddit.com/ returns 200 but the body lacks the expected JS-challenge markup: Reddit updated/removed the challenge format, Reddit served a block/captcha page to your IP instead of a challenge, a proxy or CDN rewrote the response body, or reddit already set cookies so no challenge was needed but the body also lacks the token pattern.
Common situations: Running Glance from a datacenter/VPS IP that Reddit flags, running an older Glance version after Reddit changed its anti-bot page, egress through a corporate proxy that alters responses, or Reddit regional variants serving different HTML.
Related errors
- no token found in challenge page
- 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/fedbbc6bde4f138b.
Report an issue: GitHub.