{"record":{"id":"be443a4121b827ef","repo":"badges/shields","slug":"space-not-found-or-results-purged","errorCode":null,"errorMessage":"space not found or results purged","messagePattern":"space not found or results purged","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"services/testspace/testspace-base.js","lineNumber":50,"sourceCode":"    const url = `https://${org}.testspace.com/api/projects/${encodeURIComponent(\n      project,\n    )}/spaces/${space}/results`\n    return this._requestJson({\n      schema,\n      url,\n      httpErrors: {\n        403: 'org not found or not authorized',\n        404: 'org, project, or space not found',\n      },\n      options: {\n        dnsLookupIpVersion: 4,\n      },\n    })\n  }\n\n  transformCaseCounts(json) {\n    if (json.length === 0) {\n      throw new NotFound({ prettyMessage: 'space not found or results purged' })\n    }\n\n    const [\n      {\n        case_counts: [passed, failed, skipped, errored, untested],\n      },\n    ] = json\n    const total = passed + failed + skipped + errored + untested\n\n    return { passed, failed, skipped, errored, untested, total }\n  }\n}\n","sourceCodeStart":32,"sourceCodeEnd":63,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/testspace/testspace-base.js#L32-L63","documentation":"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'.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify the space id in the badge URL against the TestSpace dashboard URL.","Run your test suite at least once in that space so results exist.","Check the TestSpace project to confirm results were not purged and re-publish results if they were."],"exampleFix":"// before\n/badge/testspace/tests/space-999?label=tests\n// after\n/badge/testspace/tests/space-12345?label=tests","handlingStrategy":"validation","validationCode":"if (!spaceId || !/^\\d+$/.test(spaceId)) throw new Error('valid TestSpace space id required')","typeGuard":null,"tryCatchPattern":"try { renderBadge() } catch (e) { if (e.prettyMessage === 'space not found or results purged') return 'no results'; throw e }","preventionTips":["Copy the space id directly from the TestSpace dashboard URL.","Ensure tests are published to the space before embedding badges.","Watch for purge/reset jobs in CI that wipe space results."],"tags":["not-found","badges","api"],"backgroundTag":"upstream-resource-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}