conwnet/github1s · error · Error

Unable to find ranking data for ${collectionName}

Error message

Unable to find ranking data for ${collectionName}

What it means

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.

Source

Thrown at extensions/github1s/src/adapters/ossinsight/templates.ts:197

| Collection | Repos | 1st repo | 2nd repo | 3rd repo |
| -- | -- | -- | -- | -- |
${hotCollectionsMarkdown.join('\n')}

***

## All Collections

${allCollectionsMarkdown.join('   |   ')}

***

`;
};

export const createCollectionPageMarkdown = async (collectionName: string) => {
	const collectionId = await getCollectionIdByName(collectionName);
	if (!collectionId) {
		throw new Error('Unable to find ranking data for ' + collectionName);
	}
	const [starsData, pullsData, issuesData] = await Promise.all([
		getCollectionStarsLast28DaysRank(collectionId),
		getCollectionPullRequestsLast28DaysRank(collectionId),
		getCollectionIssuesLast28DaysRank(collectionId),
	]);

	const starRankListMarkdown = starsData.map((item) => {
		const rankMarkdown = ` ${item.current_period_rank}${getRankChangeText(+item.rank_pop)}`;
		const repoMarkdown = ` [${item.repo_name}](${buildRepoLink(item.repo_name)})`;
		const starsMarkdown = ` ${item.current_period_growth}${getPopCountText(+item.growth_pop, true)}`;
		return `|${rankMarkdown} |${repoMarkdown} |${starsMarkdown} | ${item.past_period_growth} | ${item.total} |`;
	});

	const pullRankListMarkdown = pullsData.map((item) => {
		const rankMarkdown = ` ${item.current_period_rank}${getRankChangeText(+item.rank_pop)}`;
		const repoMarkdown = ` [${item.repo_name}](${buildRepoLink(item.repo_name)})`;
		const starsMarkdown = ` ${item.current_period_growth}${getPopCountText(+item.growth_pop, true)}`;

View on GitHub (pinned to cd25be5190)

Solutions

  1. Log/verify the exact collectionName passed in and compare against the names returned by the OSS Insight collections list API
  2. Fix the typo or update the collection name to match the current ossinsight.io collection title exactly (including casing)
  3. Handle null/undefined from getCollectionIdByName gracefully before calling it — fall back to a default collection or skip rendering the page
  4. Check the OSS Insight API status if the collection is known to exist; a transient upstream failure can yield a missing ID

Example fix

// before
const collectionId = await getCollectionIdByName(collectionName);
if (!collectionId) {
	throw new Error('Unable to find ranking data for ' + collectionName);
}
// after
const collectionId = await getCollectionIdByName(collectionName);
if (!collectionId) {
	const KNOWN = ['Top 10 trending repositories', ...];
	const suggestion = KNOWN.find(n => n.toLowerCase() === collectionName.trim().toLowerCase());
	if (suggestion) return createCollectionPageMarkdown(suggestion);
	throw new Error(`Unknown OSS Insight collection "${collectionName}"; check https://ossinsight.io/collections for valid names`);
}
Defensive patterns

Strategy: validation

Validate before calling

const collectionId = await getCollectionIdByName(name);
if (typeof collectionId !== 'number') {
  console.warn(`No ranking data for "${name}"; skipping page`);
  return null;
}
// proceed only with a valid collectionId

Type guard

function hasRankingData(v: number | null | undefined): v is number {
  return typeof v === 'number' && Number.isFinite(v);
}

Try / catch

try {
  const md = await createCollectionPageMarkdown(name);
} catch (err) {
  if (String(err).includes('Unable to find ranking data')) {
    console.warn(`Skipping collection "${name}": not found on OSS Insight`);
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.


AI-assisted analysis of conwnet/github1s@cd25be5190 (2026-08-31). Data as JSON: /api/errors/f1acf30047540238. Report an issue: GitHub.