glanceapp/glance · warning

no posts found

Error message

no posts found

What it means

The subreddit API call succeeded (JSON decoded) but returned zero posts in data.children. This is a data-level error, not a transport error: the subreddit exists as far as the API response goes but contains no listings — commonly because Reddit's bot challenge was solved but the actual feed came back empty, or the subreddit name is wrong/empty/private.

Source

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

	if err != nil {
		return nil, err
	}
	request.Header = headers

	loid, err := getRedditLoidCookie()
	if err != nil {
		fmt.Printf("Error fetching reddit loid cookie: %v\n", err)
		return nil, errors.New("could not solve reddit challenge")
	}
	request.AddCookie(&http.Cookie{Name: "loid", Value: loid})

	responseJson, err := decodeJsonFromRequest[subredditResponseJson](client, request)
	if err != nil {
		return nil, err
	}

	if len(responseJson.Data.Children) == 0 {
		return nil, fmt.Errorf("no posts found")
	}

	posts := make(forumPostList, 0, len(responseJson.Data.Children))

	for i := range responseJson.Data.Children {
		post := &responseJson.Data.Children[i].Data

		if post.Stickied || post.Pinned {
			continue
		}

		var commentsUrl string

		if widget.CommentsURLTemplate == "" {
			commentsUrl = "https://www.reddit.com" + post.Permalink
		} else {
			commentsUrl = widget.parseCustomCommentsURL(widget.Subreddit, post.Id, post.Permalink)
		}

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Check the subreddit name in the widget config (curl https://www.reddit.com/r/<name>/.json to compare)
  2. If the subreddit is private or restricted, use app auth with an account that can read it, or pick a public one
  3. If Reddit is having issues, wait for the next update cycle

Example fix

# before
  subreddit: programing
# after
  subreddit: programming
Defensive patterns

Strategy: validation

Validate before calling

if !regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_]{1,20}$`).MatchString(subreddit) {
    return fmt.Errorf("invalid subreddit name %q", subreddit)
}

Type guard

func isValidSubredditName(name string) bool {
    return regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_]{1,20}$`).MatchString(name)
}

Try / catch

posts, err := fetchSubredditPosts(...)
if err != nil {
    if strings.Contains(err.Error(), "no posts found") {
        // show the subreddit name in the panel so the typo is obvious
        widget.withError(fmt.Errorf("r/%s returned no posts", widget.Subreddit))
        return
    }
    return
}

Prevention

When it happens

Trigger: Subreddit name typo that Reddit resolves to an empty feed; private/banned/quarantined subreddit; Reddit API returning an empty children array under load; all posts filtered out.

Common situations: Typo'd subreddit (r/programing); private subreddit the app token cannot read; Reddit degradation returning empty listings; brand-new subreddit with no posts.

Related errors


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