santifer/career-ops · error
getonbrd: `categories` is empty — omit it to use the…
Error message
getonbrd: `categories` is empty — omit it to use the "programming" default
What it means
After filtering and deduplication, resolveCategories requires at least one category; an empty list cannot form a valid request. The error tells the caller to simply omit the categories field, which falls back to the 'programming' default category.
Solutions
- Remove the categories field entirely so the DEFAULT_CATEGORY ('programming') applies.
- Or populate the list with at least one valid slug.
- If 'search all categories' is the goal, that is not supported — omit categories and rely on other filters instead.
- Fix the template/script that emitted an empty array.
Example fix
# before categories: [] # after # (field omitted — defaults to "programming")
Defensive patterns
Strategy: validation
Validate before calling
if (Array.isArray(cfg.categories) && cfg.categories.length === 0) delete cfg.categories; // fall back to default
Type guard
const hasCategories = (c) => Array.isArray(c.categories) && c.categories.length > 0;
Try / catch
try { resolveCategories(entry); } catch (e) { if (e.message.includes('`categories` is empty')) console.error('Omit categories to use the default, or supply at least one slug'); throw e; } Prevention
- Delete the field rather than leaving it empty — omission IS the default
- Guard template generators against emitting empty arrays
- Document that 'all categories' is expressed by omitting the field
- Validate config at startup so the mistake surfaces before scans
When it happens
Trigger: Configuring categories: [] explicitly; an entry whose categories value is an empty YAML list, e.g. produced by a templating step that had no categories selected (non-matching entries throw error 257 first, so this fires only for a valid-typed but empty list).
Common situations: Templating/CI generating portals.yml emitted categories: [] when no categories were chosen; a user clearing the field to mean 'everything' without realizing omission is the correct way to get the default.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- apify: entry has invalid field_map. Each of title, url…
- apify: entry missing 'actor' (e.g. misceres/indeed-scraper)
- arbeitnow: invalid URL
- ashby: invalid URL
- bamboohr: invalid URL
AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16).
Data as JSON: /api/errors/43451d60ab2fad21.
Report an issue: GitHub.
Appendix: source
Thrown at providers/getonbrd.mjs:65
* @returns {string[]}
*/
export function resolveCategories(entry) {
const raw = entry?.categories !== undefined ? entry.categories : entry?.category;
if (raw === undefined || raw === null) return [DEFAULT_CATEGORY];
const list = Array.isArray(raw) ? raw : [raw];
const out = [];
for (const c of list) {
if (typeof c !== 'string' || !CATEGORY_SLUG_RE.test(c.trim())) {
throw new Error(
`getonbrd: invalid category ${JSON.stringify(c)} — expected a slug like "programming" or "machine-learning-ai"`,
);
}
const slug = c.trim();
if (!out.includes(slug)) out.push(slug);
}
if (!out.length) {
throw new Error('getonbrd: `categories` is empty — omit it to use the "programming" default');
}
if (out.length > MAX_CATEGORIES) {
throw new Error(
`getonbrd: ${out.length} categories configured — cap is ${MAX_CATEGORIES} (each one costs up to max_pages requests)`,
);
}
return out;
}
/** @param {string} url */
function assertGetonbrdUrl(url) {
let parsed;
try {
parsed = new URL(url);
} catch {
throw new Error(`getonbrd: invalid URL: ${url}`);
}
if (parsed.protocol !== 'https:') throw new Error(`getonbrd: URL must use HTTPS: ${url}`);View on GitHub (pinned to aac998c7ed)