badges/shields · error · NotFound
subreddit not found
Error message
subreddit not found
What it means
The Reddit subreddit-subscribers badge throws NotFound 'subreddit not found' when the Reddit API response lacks json.data.subscribers. Reddit returns a 200 with a listing/error payload for nonexistent, banned, or private subreddits, so the service checks for the subscribers field and signals the subreddit doesn't exist.
Source
Thrown at services/reddit/subreddit-subscribers.service.js:63
async fetch({ subreddit }) {
return this._requestJson({
schema,
// API requests with a bearer token should be made to https://oauth.reddit.com, NOT www.reddit.com.
url: this.authHelper.isConfigured
? `https://oauth.reddit.com/r/${subreddit}/about.json`
: `https://www.reddit.com/r/${subreddit}/about.json`,
httpErrors: {
404: 'subreddit not found',
403: 'subreddit is private',
},
})
}
transform(json) {
const subscribers = json.data.subscribers
if (subscribers === undefined) {
throw new NotFound({ prettyMessage: 'subreddit not found' })
}
return { subscribers }
}
async handle({ subreddit }) {
const json = await this.fetch({ subreddit })
const { subscribers } = this.transform(json)
return this.constructor.render({
subreddit,
subscribers,
})
}
}
View on GitHub (pinned to 766fd8bc89)
Solutions
- Verify the subreddit name exists by visiting reddit.com/r/<name>
- Check the subreddit isn't private, banned, or quarantined
- If requests come from a blocked IP, configure a proxy or check Reddit API rate limiting
Example fix
// before /badge/reddit-subscribers/mysubreddit (typo) // after /badge/reddit-subscribers/javascript
Defensive patterns
Strategy: try-catch
Validate before calling
const r = await fetch(`https://www.reddit.com/r/${subreddit}/about.json`)
const j = await r.json()
if (j?.data?.subscribers === undefined) throw new Error(`subreddit ${subreddit} not found or inaccessible`) Type guard
function isSubredditData(json) {
return typeof json?.data?.subscribers === 'number'
} Try / catch
try {
const badge = await service.handle({ subreddit })
} catch (err) {
if (err instanceof NotFound && err.prettyMessage === 'subreddit not found') {
return renderBadge({ label: 'reddit', message: 'n/a' })
}
throw err
} Prevention
- Visit reddit.com/r/<name> to confirm existence before adding the badge
- Account for banned/private subreddits when removing projects
- If self-hosting, ensure egress IPs are not blocked by Reddit (rate limits/proxies)
When it happens
Trigger: Requesting a badge for a subreddit that doesn't exist, was banned/quarantined, is private, or whose API response shape lacks data.subscribers (e.g. rate-limited or blocked responses).
Common situations: Typos in the subreddit name; subreddit banned or set private since the badge was added; Reddit blocking datacenter IPs so responses lack subscriber data; case-sensitive naming mistakes.
Related errors
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/24fb78ba965381a9.
Report an issue: GitHub.