Skip to content

Billing invoice list silently swallows API errors — customers with invoices can be shown "No invoices" #550

Closed

Description

@gkhngyk

Problem

web/src/components/settings/invoice-list.tsx fetches /api/stripe/invoices with no error handling:

fetch('/api/stripe/invoices')
  .then((r) => r.json())
  .then((data) => {
    if (Array.isArray(data)) setInvoices(data);
  })
  .finally(() => setLoading(false));

If the route returns a 500 or an { error } body, the Array.isArray guard silently swallows it and .finally clears loading — so a customer with real invoices is shown the "No invoices" empty state. That's the worst kind of silent failure: indistinguishable from a legitimately empty list. There's also no .catch(), so a network failure becomes an unhandled promise rejection.

Fix

Every sibling settings component (plan-switcher.tsx, api-keys-section.tsx, agent-section.tsx) already uses the if (!res.ok) throw new Error(body.error || …) pattern — this file is the one straggler.

  1. Check res.ok and throw/parse the error body.
  2. Add a .catch() that sets an error state.
  3. Render a distinct error state (with a retry button) separate from the "No invoices" empty state.

Acceptance

  • When the invoices API fails, the user sees an error state with a retry option — never the "No invoices" empty state.

Activity

  1. added
    bug
    good first issue
    on Jul 28, 2026
  2. arambu1a commented on Jul 29, 2026

    @arambu1a
    Contributor

    Hi @gkhngyk I'll work on this

  3. arambu1a commented on Jul 30, 2026

    @arambu1a
    Contributor

    Hi @gkhngyk could you please close this issue

  4. added a commit that references this issue on Aug 2, 2026
    3182b69
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions