badges/shields · error · NotFound

space not found or results purged

Error message

space not found or results purged

What it means

The TestSpace badge service throws this NotFound error from transformCaseCounts when the API returns an empty case-count array, meaning the space exists only with no results or the space id is wrong. transformCaseCounts destructures the first element of the case_counts array, so an empty array would otherwise cause an undefined destructure, hence the explicit throw. It signals 'we could not produce any test statistics for this space'.

Source

Thrown at services/testspace/testspace-base.js:50

    const url = `https://${org}.testspace.com/api/projects/${encodeURIComponent(
      project,
    )}/spaces/${space}/results`
    return this._requestJson({
      schema,
      url,
      httpErrors: {
        403: 'org not found or not authorized',
        404: 'org, project, or space not found',
      },
      options: {
        dnsLookupIpVersion: 4,
      },
    })
  }

  transformCaseCounts(json) {
    if (json.length === 0) {
      throw new NotFound({ prettyMessage: 'space not found or results purged' })
    }

    const [
      {
        case_counts: [passed, failed, skipped, errored, untested],
      },
    ] = json
    const total = passed + failed + skipped + errored + untested

    return { passed, failed, skipped, errored, untested, total }
  }
}

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Verify the space id in the badge URL against the TestSpace dashboard URL.
  2. Run your test suite at least once in that space so results exist.
  3. Check the TestSpace project to confirm results were not purged and re-publish results if they were.

Example fix

// before
/badge/testspace/tests/space-999?label=tests
// after
/badge/testspace/tests/space-12345?label=tests
Defensive patterns

Strategy: validation

Validate before calling

if (!spaceId || !/^\d+$/.test(spaceId)) throw new Error('valid TestSpace space id required')

Try / catch

try { renderBadge() } catch (e) { if (e.prettyMessage === 'space not found or results purged') return 'no results'; throw e }

Prevention

When it happens

Trigger: Calling any TestSpace test-count badge (passed, failed, skipped, errored, untested, total, or combinations) with a space id whose case counts API response is an empty array (json.length === 0).

Common situations: Typo in or stale space id; the space's results were purged/reset on TestSpace; a newly created space with no test runs yet; wrong project/space selected in the badge URL.

Related errors


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