santifer/career-ops · error

getonbrd: invalid category

Error message

getonbrd: invalid category ${JSON.stringify(c)} — expected a slug like "programming" or "machine-learning-ai"

What it means

resolveCategories validates every configured Getonboard category against CATEGORY_SLUG_RE (lowercase kebab-case slugs). Values that are not strings or do not match the slug pattern are rejected with this message showing the offending value JSON-encoded and an example of valid slugs.

Solutions

  1. Convert each category to its Getonboard slug: lowercase, hyphen-separated (e.g. 'machine-learning-ai').
  2. Quote values in YAML that could parse as non-strings (numbers, booleans).
  3. Browse getonbrd.com category URLs to confirm the exact slug spelling before configuring it.
  4. Start from the documented defaults ('programming', 'machine-learning-ai') and only add slugs you've verified.

Example fix

// before
categories: ["Data Science", "Programming"]
// after
categories: ["data-science", "programming"]
Defensive patterns

Strategy: validation

Validate before calling

const CATEGORY_SLUG_RE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
const bad = (cfg.categories || []).filter(c => typeof c !== 'string' || !CATEGORY_SLUG_RE.test(c.trim()));
if (bad.length) throw new Error(`Non-slug categories: ${bad.join(', ')}`);

Type guard

const isCategorySlug = (c) => typeof c === 'string' && /^[a-z0-9]+(-[a-z0-9]+)*$/.test(c.trim());

Try / catch

try { resolveCategories(entry); } catch (e) { if (e.message.includes('invalid category')) console.error('Convert display names to slugs and quote YAML values:', e.message); throw e; }

Prevention

When it happens

Trigger: Configuring categories: ['Machine Learning'] (spaces/capitals), ['programming', 42] (non-string member), or 'Software Development' — anything failing CATEGORY_SLUG_RE — in portals.yml or wherever the entry's categories field is set.

Common situations: Writing human-readable category names instead of the portal's URL slugs; YAML parsing a category as a number or boolean (e.g. an unquoted value); copy-pasting a display label from the Getonboard UI instead of its slug.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16). Data as JSON: /api/errors/7634df7bf942ea8d. Report an issue: GitHub.

Appendix: source

Thrown at providers/getonbrd.mjs:57

/**
 * Resolve the categories to scan, in config order, deduped.
 *
 * `categories:` (array) wins over `category:` (string); neither → the
 * `programming` default, which keeps pre-existing entries byte-identical.
 * Exported for tests.
 *
 * @param {any} entry
 * @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 */

View on GitHub (pinned to aac998c7ed)