{"record":{"id":"823579a0d23588d1","repo":"glanceapp/glance","slug":"no-posts-found","errorCode":null,"errorMessage":"no posts found","messagePattern":"no posts found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/glance/widget-reddit.go","lineNumber":235,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\trequest.Header = headers\n\n\tloid, err := getRedditLoidCookie()\n\tif err != nil {\n\t\tfmt.Printf(\"Error fetching reddit loid cookie: %v\\n\", err)\n\t\treturn nil, errors.New(\"could not solve reddit challenge\")\n\t}\n\trequest.AddCookie(&http.Cookie{Name: \"loid\", Value: loid})\n\n\tresponseJson, err := decodeJsonFromRequest[subredditResponseJson](client, request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(responseJson.Data.Children) == 0 {\n\t\treturn nil, fmt.Errorf(\"no posts found\")\n\t}\n\n\tposts := make(forumPostList, 0, len(responseJson.Data.Children))\n\n\tfor i := range responseJson.Data.Children {\n\t\tpost := &responseJson.Data.Children[i].Data\n\n\t\tif post.Stickied || post.Pinned {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar commentsUrl string\n\n\t\tif widget.CommentsURLTemplate == \"\" {\n\t\t\tcommentsUrl = \"https://www.reddit.com\" + post.Permalink\n\t\t} else {\n\t\t\tcommentsUrl = widget.parseCustomCommentsURL(widget.Subreddit, post.Id, post.Permalink)\n\t\t}","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/glanceapp/glance/blob/91324e8de762702e97b0ac5c8e36271d644d8642/internal/glance/widget-reddit.go#L217-L253","documentation":"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.","triggerScenarios":"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.","commonSituations":"Typo'd subreddit (r/programing); private subreddit the app token cannot read; Reddit degradation returning empty listings; brand-new subreddit with no posts.","solutions":["Check the subreddit name in the widget config (curl https://www.reddit.com/r/<name>/.json to compare)","If the subreddit is private or restricted, use app auth with an account that can read it, or pick a public one","If Reddit is having issues, wait for the next update cycle"],"exampleFix":"# before\n  subreddit: programing\n# after\n  subreddit: programming","handlingStrategy":"validation","validationCode":"if !regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_]{1,20}$`).MatchString(subreddit) {\n    return fmt.Errorf(\"invalid subreddit name %q\", subreddit)\n}","typeGuard":"func isValidSubredditName(name string) bool {\n    return regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_]{1,20}$`).MatchString(name)\n}","tryCatchPattern":"posts, err := fetchSubredditPosts(...)\nif err != nil {\n    if strings.Contains(err.Error(), \"no posts found\") {\n        // show the subreddit name in the panel so the typo is obvious\n        widget.withError(fmt.Errorf(\"r/%s returned no posts\", widget.Subreddit))\n        return\n    }\n    return\n}","preventionTips":["Verify subreddit names with a quick curl to reddit.com/r/<name>/.json before adding them","Avoid private/restricted subreddits unless the app token can read them"],"tags":["reddit","empty-response","configuration","data"],"backgroundTag":null,"analyzedSha":"91324e8de762702e97b0ac5c8e36271d644d8642","analyzedAt":"2026-08-15T14:12:54.279Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}