badges/shields · warning · InvalidResponse

no public giving stats

Error message

no public giving stats

What it means

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.

Source

Thrown at services/liberapay/liberapay-gives.service.js:28

        summary: 'Liberapay giving',
        parameters: pathParams({
          name: 'entity',
          example: 'Changaco',
        }),
      },
    },
  }

  async handle({ entity }) {
    const data = await this.fetch({ entity })
    if (data.giving) {
      return renderCurrencyBadge({
        label: 'gives',
        amount: data.giving.amount,
        currency: data.giving.currency,
      })
    } else {
      throw new InvalidResponse({ prettyMessage: 'no public giving stats' })
    }
  }
}

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. On Liberapay, disable the privacy option hiding giving amounts in profile settings (Privacy tab) if you own the account.
  2. If you don't control the account, the user keeps giving private — use a different badge (receives/goal) or remove this one.
  3. Verify the entity name matches the Liberapay username.
Defensive patterns

Strategy: try-catch

Validate before calling

// Inspect the Liberapay API for public giving data before rendering:
const res = await fetch(`https://liberapay.com/${entity}/public.json`);
const data = await res.json();
const givesPublicly = Boolean(data.giving && data.giving.amount != null);
if (!givesPublicly) console.warn(`${entity} does not publish giving stats`);

Type guard

function hasPublicGiving(data) {
  return Boolean(data?.giving && typeof data.giving.amount === 'number' && typeof data.giving.currency === 'string');
}

Try / catch

try {
  badge = await getLiberapayGivesBadge(entity);
} catch (e) {
  if (e.name === 'InvalidResponse') {
    badge = renderBadge('gives', 'hidden');
  } else throw e;
}

Prevention

When it happens

Trigger: Requesting /liberapay/gives/<entity> where the fetched Liberapay profile JSON has no `giving` object (user has privacy enabled on giving or gives nothing).

Common situations: 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.

Related errors


AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30). Data as JSON: /api/errors/5e15db03be144625. Report an issue: GitHub.