{"record":{"id":"017106722883151b","repo":"wtfutil/wtf","slug":"no-links","errorCode":null,"errorMessage":"no links","messagePattern":"no links","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"modules/subreddit/api.go","lineNumber":50,"sourceCode":"\tresp, err := client.Do(request)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif resp.StatusCode > 299 {\n\t\treturn nil, fmt.Errorf(\"%s\", resp.Status)\n\t}\n\tvar m RedditDocument\n\terr = utils.ParseJSON(&m, resp.Body)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(m.Data.Children) == 0 {\n\t\treturn nil, fmt.Errorf(\"no links\")\n\t}\n\n\tvar links []Link\n\tfor _, l := range m.Data.Children {\n\t\tlinks = append(links, l.Data)\n\t}\n\treturn links, nil\n}\n","sourceCodeStart":32,"sourceCodeEnd":59,"githubUrl":"https://github.com/wtfutil/wtf/blob/bb838c1ccb0f0f3223690df44afdec663d622881/modules/subreddit/api.go#L32-L59","documentation":"GetLinks successfully parses a Reddit listing JSON but finds zero children in data.children, meaning the subreddit listing is empty. It treats an empty feed as an error because the widget has nothing to render.","triggerScenarios":"HTTP 200 with valid listing JSON whose data.children array is empty — e.g. a brand-new subreddit with no posts, a heavily filtered/quarantined subreddit, or a subreddit returning an empty listing to unauthenticated requests.","commonSituations":"Freshly created subreddits with no submissions; subreddits where all posts were removed; spammed/hidden listings; rare cases of Reddit returning empty payloads to anonymous users.","solutions":["Verify the subreddit actually has posts by visiting reddit.com/r/<name>","Pick a more active subreddit in the widget config","Log in / use authenticated API access if Reddit hides listings from anonymous requests","Treat this as expected in callers for low-traffic subreddits"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// fetch the listing and check before use\nif doc.Data != nil && len(doc.Data.Children) == 0 { return nil, errEmptyFeed }","typeGuard":null,"tryCatchPattern":"links, err := GetLinks(subreddit)\nif err != nil {\n    if err.Error() == \"no links\" { renderEmptyState(); return }\n    return err\n}","preventionTips":["Choose active subreddits with regular posts","Render an empty state instead of failing the widget on empty feeds","Check reddit.com/r/<name> returns posts for anonymous visitors","Account for new subreddits starting with zero children"],"tags":["reddit","empty-result","go"],"backgroundTag":"empty-api-result","analyzedSha":"bb838c1ccb0f0f3223690df44afdec663d622881","analyzedAt":"2026-09-03T17:02:45.030Z","contentChangedAt":"2026-09-03T17:02:45.030Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}