jackwener/OpenCLI · error · CliError
NO_DATA
NO_DATA
Error message
No products found for category "${slug}" What it means
A CliError with code NO_DATA thrown by the producthunt browse command when, after navigating to https://www.producthunt.com/categories/<slug> and running the interceptor + DOM extraction, zero product cards were found. The error message includes the offending category slug and a hint listing valid category slugs, so it signals either a bad/typo'd slug or that the page rendered no product cards for that category.
Source
Thrown at clis/producthunt/browse.js:90
}
container = container.parentElement;
}
seen.add(href);
results.push({
name,
tagline: tagline.slice(0, 120),
reviews: reviews || '0',
url: 'https://www.producthunt.com' + href,
});
}
return results;
})()
`);
const items = Array.isArray(domItems) ? domItems : [];
if (items.length === 0) {
throw new CliError('NO_DATA', `No products found for category "${slug}"`, 'Check the category slug or try: ' + PRODUCTHUNT_CATEGORY_SLUGS.slice(0, 5).join(', '));
}
return items.slice(0, count).map((item, i) => ({
rank: i + 1,
name: item.name,
tagline: item.tagline,
reviews: item.reviews,
url: item.url,
}));
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Use a valid slug from PRODUCTHUNT_CATEGORY_SLUGS (the error hint lists the first five) — e.g. developer-tools, ai-agents.
- Verify the slug against https://www.producthunt.com/categories in a browser to confirm the category page exists and lists products.
- Re-run later or increase the capture wait if it was a transient network/render timeout.
- If the page renders but extraction is empty, update the DOM selector (a[href^="/products/"] + flex-col class) to match Product Hunt's current markup.
Example fix
// before await cli browse producthunt "artifical-intelligence" // CliError NO_DATA: No products found for category "artifical-intelligence" // after await cli browse producthunt "artificial-intelligence"
Defensive patterns
Strategy: validation
Validate before calling
import { PRODUCTHUNT_CATEGORY_SLUGS } from './utils.js';
function validateCategorySlug(slug) {
const s = String(slug || '').trim().toLowerCase();
if (!PRODUCTHUNT_CATEGORY_SLUGS.includes(s)) {
throw new Error(`Invalid category slug "${s}". Valid: ${PRODUCTHUNT_CATEGORY_SLUGS.join(', ')}`);
}
return s;
} Type guard
function isValidCategorySlug(slug) {
return typeof slug === 'string' && PRODUCTHUNT_CATEGORY_SLUGS.includes(slug.trim().toLowerCase());
} Try / catch
try {
products = await browseProducthunt(slug, { limit });
} catch (err) {
if (err?.code === 'NO_DATA') {
console.error(`No products for "${slug}" — try a valid slug e.g. developer-tools`);
products = [];
} else throw err;
} Prevention
- Validate the category slug against PRODUCTHUNT_CATEGORY_SLUGS before invoking browse.
- Copy slugs from the error hint or producthunt.com/categories rather than guessing.
- Keep the card selector (a[href^="/products/"] + flex-col) checked after Product Hunt redesigns.
- Increase waitForCapture time or retry once when on a slow network to rule out render timeouts.
When it happens
Trigger: Calling producthunt browse with a category positional arg that is not one of PRODUCTHUNT_CATEGORY_SLUGS (typo, spacing, wrong casing handled only by toLowerCase), or a slug page that loads but yields no a[href^="/products/"] cards matching the flex-col filter (layout change, empty category, or capture timeout within waitForCapture(5)).
Common situations: Typo'd or invented slug like 'ai' instead of a real Product Hunt category; Product Hunt renamed/removed a category slug; page needs login or shows an interstitial so no product cards render; Product Hunt DOM/class-name change breaking the card-link selector; slow network exceeding the 5s capture window.
Related errors
- NO_DATA
- NO_DATA
- No coaches for ${fromCity} to ${toCity} on ${date}
- Ctrip round-trip flight DOM extraction returned malformed ro
- Ctrip round-trip flight cards rendered but parser did not fi
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/38242a60a0741e0b.
Report an issue: GitHub.