badges/shields · info · InvalidResponse
private
Error message
private
What it means
The freeCodeCamp points service reads response.entities.user[username].points from the API response. When the user's points are null — freeCodeCamp marks profiles private — the transform throws InvalidResponse with prettyMessage 'private', indicating the data exists but is intentionally hidden.
Source
Thrown at services/freecodecamp/freecodecamp-points.service.js:70
return this._requestJson({
schema,
url: 'https://api.freecodecamp.org/users/get-public-profile',
options: {
searchParams: {
username,
},
},
httpErrors: { 404: 'profile not found' },
})
}
static transform(response, username) {
const { entities } = response
const { points } = entities.user[username]
if (points === null) {
throw new InvalidResponse({ prettyMessage: 'private' })
}
return points
}
async handle({ username }) {
const response = await this.fetch({ username })
const points = this.constructor.transform(response, username)
return this.constructor.render({ points })
}
}
View on GitHub (pinned to 766fd8bc89)
Solutions
- Respect the user's privacy choice — remove the points badge or replace it with a non-stat badge
- Ask the profile owner to make their points public in freeCodeCamp privacy settings
- Verify the username is correct and points to the intended public account
Example fix
// before /badge/freecodecamp/points/privateuser // points hidden // after (choose public user or drop badge) /badge/freecodecamp/points/publicuser
Defensive patterns
Strategy: try-catch
Validate before calling
async function pointsArePublic(username) {
const res = await fetch(`https://api.freecodecamp.org/api/users/get-public-profile?username=${username}`)
const json = await res.json()
const entity = json.entities && json.entities.user && json.entities.user[username]
return Boolean(entity) && entity.points !== null
}
// only render the badge when points are public Type guard
function hasPublicPoints(response, username) {
const user = response?.entities?.user?.[username]
return user != null && typeof user.points === 'number'
} Try / catch
try {
const points = await getFreeCodeCampPoints(username)
} catch (e) {
if (e.prettyMessage === 'private') {
renderPlaceholderBadge('points private')
} else throw e
} Prevention
- Check that the profile's points are publicly visible before adding a badge
- Handle the case where a user later switches to private mode (badge degrades gracefully)
- Confirm the username spelling matches the public profile
- Offer a fallback badge type for users with private stats
When it happens
Trigger: Requesting a freeCodeCamp points badge for a username whose profile privacy settings hide their points (points === null in the API response).
Common situations: Badge on the profile of a user who has opted out of public stats; user later enabled privacy mode so a previously working badge starts failing; case-sensitivity issues resolved to a private account.
Related errors
- no public giving stats
- no public receiving stats
- invalid response data from auth endpoint
- unparseable svg response
- unparseable toml response
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/e69d5090141d1168.
Report an issue: GitHub.