{"record":{"id":"f1acf30047540238","repo":"conwnet/github1s","slug":"unable-to-find-ranking-data-for-collectionname","errorCode":null,"errorMessage":"Unable to find ranking data for ${collectionName}","messagePattern":"Unable to find ranking data for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/github1s/src/adapters/ossinsight/templates.ts","lineNumber":197,"sourceCode":"| Collection | Repos | 1st repo | 2nd repo | 3rd repo |\n| -- | -- | -- | -- | -- |\n${hotCollectionsMarkdown.join('\\n')}\n\n***\n\n## All Collections\n\n${allCollectionsMarkdown.join(' &nbsp; | &nbsp; ')}\n\n***\n\n`;\n};\n\nexport const createCollectionPageMarkdown = async (collectionName: string) => {\n\tconst collectionId = await getCollectionIdByName(collectionName);\n\tif (!collectionId) {\n\t\tthrow new Error('Unable to find ranking data for ' + collectionName);\n\t}\n\tconst [starsData, pullsData, issuesData] = await Promise.all([\n\t\tgetCollectionStarsLast28DaysRank(collectionId),\n\t\tgetCollectionPullRequestsLast28DaysRank(collectionId),\n\t\tgetCollectionIssuesLast28DaysRank(collectionId),\n\t]);\n\n\tconst starRankListMarkdown = starsData.map((item) => {\n\t\tconst rankMarkdown = ` ${item.current_period_rank}${getRankChangeText(+item.rank_pop)}`;\n\t\tconst repoMarkdown = ` [${item.repo_name}](${buildRepoLink(item.repo_name)})`;\n\t\tconst starsMarkdown = ` ${item.current_period_growth}${getPopCountText(+item.growth_pop, true)}`;\n\t\treturn `|${rankMarkdown} |${repoMarkdown} |${starsMarkdown} | ${item.past_period_growth} | ${item.total} |`;\n\t});\n\n\tconst pullRankListMarkdown = pullsData.map((item) => {\n\t\tconst rankMarkdown = ` ${item.current_period_rank}${getRankChangeText(+item.rank_pop)}`;\n\t\tconst repoMarkdown = ` [${item.repo_name}](${buildRepoLink(item.repo_name)})`;\n\t\tconst starsMarkdown = ` ${item.current_period_growth}${getPopCountText(+item.growth_pop, true)}`;","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/conwnet/github1s/blob/cd25be519042b97704c2faa6bc801e5c829c0b30/extensions/github1s/src/adapters/ossinsight/templates.ts#L179-L215","documentation":"This error is thrown by createCollectionPageMarkdown in the github1s OSS Insight adapter when the given collection name cannot be resolved to a collection ID via getCollectionIdByName. The library requires a valid ranking-data collection (e.g. 'Top 10 trending repositories') to fetch star/PR/issue rank data; if the lookup returns a falsy ID, no such ranking collection exists upstream and rendering cannot proceed.","triggerScenarios":"Calling createCollectionPageMarkdown(collectionName) with a name that does not match any OSS Insight collection: a typo, a collection that was renamed or removed on ossinsight.io, an empty string, or a transient API response missing the ID.","commonSituations":"Hard-coded collection names in templates drift after ossinsight.io renames collections; user-supplied collection names contain different casing or whitespace than the API expects; the OSS Insight API returns no ID due to schema or upstream data changes.","solutions":["Log/verify the exact collectionName passed in and compare against the names returned by the OSS Insight collections list API","Fix the typo or update the collection name to match the current ossinsight.io collection title exactly (including casing)","Handle null/undefined from getCollectionIdByName gracefully before calling it — fall back to a default collection or skip rendering the page","Check the OSS Insight API status if the collection is known to exist; a transient upstream failure can yield a missing ID"],"exampleFix":"// before\nconst collectionId = await getCollectionIdByName(collectionName);\nif (!collectionId) {\n\tthrow new Error('Unable to find ranking data for ' + collectionName);\n}\n// after\nconst collectionId = await getCollectionIdByName(collectionName);\nif (!collectionId) {\n\tconst KNOWN = ['Top 10 trending repositories', ...];\n\tconst suggestion = KNOWN.find(n => n.toLowerCase() === collectionName.trim().toLowerCase());\n\tif (suggestion) return createCollectionPageMarkdown(suggestion);\n\tthrow new Error(`Unknown OSS Insight collection \"${collectionName}\"; check https://ossinsight.io/collections for valid names`);\n}","handlingStrategy":"validation","validationCode":"const collectionId = await getCollectionIdByName(name);\nif (typeof collectionId !== 'number') {\n  console.warn(`No ranking data for \"${name}\"; skipping page`);\n  return null;\n}\n// proceed only with a valid collectionId","typeGuard":"function hasRankingData(v: number | null | undefined): v is number {\n  return typeof v === 'number' && Number.isFinite(v);\n}","tryCatchPattern":"try {\n  const md = await createCollectionPageMarkdown(name);\n} catch (err) {\n  if (String(err).includes('Unable to find ranking data')) {\n    console.warn(`Skipping collection \"${name}\": not found on OSS Insight`);\n  } else {\n    throw err;\n  }\n}","preventionTips":["Validate collection names against the OSS Insight collections list before rendering","Normalize input (trim, compare case-insensitively) before lookup","Keep a fallback/default collection for unknown names","Cache collection name-to-ID mappings and refresh periodically to catch upstream renames"],"tags":["data-lookup","api","missing-data","ossinsight"],"backgroundTag":"collection-not-found","analyzedSha":"cd25be519042b97704c2faa6bc801e5c829c0b30","analyzedAt":"2026-08-31T23:24:16.677Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}