{"record":{"id":"5e15db03be144625","repo":"badges/shields","slug":"no-public-giving-stats","errorCode":null,"errorMessage":"no public giving stats","messagePattern":"no public giving stats","errorType":"exception","errorClass":"InvalidResponse","httpStatus":null,"severity":"warning","filePath":"services/liberapay/liberapay-gives.service.js","lineNumber":28,"sourceCode":"        summary: 'Liberapay giving',\n        parameters: pathParams({\n          name: 'entity',\n          example: 'Changaco',\n        }),\n      },\n    },\n  }\n\n  async handle({ entity }) {\n    const data = await this.fetch({ entity })\n    if (data.giving) {\n      return renderCurrencyBadge({\n        label: 'gives',\n        amount: data.giving.amount,\n        currency: data.giving.currency,\n      })\n    } else {\n      throw new InvalidResponse({ prettyMessage: 'no public giving stats' })\n    }\n  }\n}\n","sourceCodeStart":10,"sourceCodeEnd":32,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/liberapay/liberapay-gives.service.js#L10-L32","documentation":"The Liberapay giving badge throws InvalidResponse when the Liberapay API returns data without public giving statistics (`data.giving` is falsy or lacks amount/currency). Liberapay users can hide their giving amounts, so the service treats absent giving data as an unusable response rather than rendering a badge.","triggerScenarios":"Requesting /liberapay/gives/<entity> where the fetched Liberapay profile JSON has no `giving` object (user has privacy enabled on giving or gives nothing).","commonSituations":"Liberapay account with 'hide giving amounts' privacy setting enabled; user who has never pledged to anyone; wrong entity name in the badge URL resolving to a profile without public giving data.","solutions":["On Liberapay, disable the privacy option hiding giving amounts in profile settings (Privacy tab) if you own the account.","If you don't control the account, the user keeps giving private — use a different badge (receives/goal) or remove this one.","Verify the entity name matches the Liberapay username."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Inspect the Liberapay API for public giving data before rendering:\nconst res = await fetch(`https://liberapay.com/${entity}/public.json`);\nconst data = await res.json();\nconst givesPublicly = Boolean(data.giving && data.giving.amount != null);\nif (!givesPublicly) console.warn(`${entity} does not publish giving stats`);","typeGuard":"function hasPublicGiving(data) {\n  return Boolean(data?.giving && typeof data.giving.amount === 'number' && typeof data.giving.currency === 'string');\n}","tryCatchPattern":"try {\n  badge = await getLiberapayGivesBadge(entity);\n} catch (e) {\n  if (e.name === 'InvalidResponse') {\n    badge = renderBadge('gives', 'hidden');\n  } else throw e;\n}","preventionTips":["Check the account's privacy settings — giving amounts may be hidden","Prefer badges backed by data the account actually exposes","Render a neutral placeholder instead of failing on private profiles"],"tags":["liberapay","privacy","invalid-response","empty-data"],"backgroundTag":"upstream-data-hidden-or-missing","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}