{"record":{"id":"c8d450be5d043b2b","repo":"badges/shields","slug":"unknown-type-provider-or-upstream-issue","errorCode":null,"errorMessage":"unknown type, provider, or upstream issue","messagePattern":"unknown type, provider, or upstream issue","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"services/clearlydefined/clearlydefined-score.service.js","lineNumber":78,"sourceCode":"  static render({ score }) {\n    score = Math.round(score)\n    return {\n      label: 'score',\n      message: `${score}/100`,\n      color: floorCountColor(score, 40, 60, 100),\n    }\n  }\n\n  async fetch({ type, provider, namespace, name, revision }) {\n    const { buffer } = await this._request({\n      url: `https://api.clearlydefined.io/definitions/${type}/${provider}/${namespace}/${name}/${revision}`,\n      options: { headers: { Accept: 'application/json' } },\n    })\n    // If the type or provider is not found, the API returns a 200 response\n    // with an empty body. It cannot be parsed as JSON, we need to handle this\n    // case earlier than in the usual BaseJsonService._requestJson flow.\n    if (buffer.length === 0) {\n      throw new NotFound({\n        prettyMessage: 'unknown type, provider, or upstream issue',\n      })\n    }\n    const json = parseJson(buffer)\n    return this.constructor._validate(json, schema)\n  }\n\n  async handle({ type, provider, namespace, name, revision }) {\n    const data = await this.fetch({ type, provider, namespace, name, revision })\n    // Return score only if definition contains some files,\n    // else it was an incomplete response due to unknown coordinates\n    if (data.described.files > 0) {\n      return this.constructor.render({ score: data.scores.effective })\n    } else {\n      throw new NotFound({\n        prettyMessage: 'unknown namespace, name, or revision',\n      })\n    }","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/clearlydefined/clearlydefined-score.service.js#L60-L96","documentation":"ClearlyDefined's API returns HTTP 200 with an empty body when the requested definition type or provider is unknown, which cannot be parsed as JSON. This service detects the empty buffer before the normal JSON parsing flow and throws NotFound with this message.","triggerScenarios":"Calling the clearlydefined score badge with a `type`/`provider` combination (e.g. wrong coordinate path) that the ClearlyDefined API answers with a 200 + empty body instead of 404.","commonSituations":"Misspelled ecosystem type (e.g. 'npm' vs 'maven' confusion), unsupported provider strings, or ClearlyDefined upstream outages/degradations that yield empty responses.","solutions":["Check that the type and provider in the badge URL match ClearlyDefined's supported coordinates (e.g. npm/npmjs, gem/rubygems, maven/mavencentral)","Verify the definition exists at https://clearlydefined.org/ for the given coordinates","Retry later if ClearlyDefined is having an outage producing empty responses","Correct the coordinate path segment order (type/provider/namespace/name/revision)"],"exampleFix":"// before\n/badge/clearlydefined/score/typo-type/npmjs/lodash/4.17.21\n// after\n/badge/clearlydefined/score/npm/npmjs/lodash/4.17.21","handlingStrategy":"validation","validationCode":"const SUPPORTED = ['npm/npmjs','gem/rubygems','maven/mavencentral','pypi/pypi','github/github','crate/cratesio'];\nconst coords = `${type}/${provider}`;\nif (!SUPPORTED.includes(coords)) throw new Error(`unsupported ClearlyDefined coordinates: ${coords}`);","typeGuard":"function isNonEmptyBuffer(b) { return Buffer.isBuffer(b) && b.length > 0; }","tryCatchPattern":"try {\n  const score = await fetchClearlyDefinedScore(type, provider, ns, name, rev);\n} catch (e) {\n  if (e.status === 404) console.warn('unknown type/provider or upstream issue — verify coordinates on clearlydefined.org');\n  else throw e;\n}","preventionTips":["Cross-check type/provider against ClearlyDefined's documented coordinate schemes","Look up the definition on clearlydefined.org before wiring the badge","Handle upstream outages: empty 200 bodies from ClearlyDefined surface as this error","Pin the exact coordinate path order: type/provider/namespace/name/revision"],"tags":["not-found","clearlydefined","upstream","empty-response"],"backgroundTag":"resource-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}