santifer/career-ops · error

getonbrd: unexpected API response for category

Error message

getonbrd: unexpected API response for category "${category}" on page ${page} — expected { data: [...] }, got keys: [${json ? Object.keys(json).join(', ') : 'null'}]

What it means

The getonbrd provider's fetch loop calls the public JSON:API feed (categories/{slug}/jobs?per_page=100&expand[]=company&page=N) with redirect:'error'. It requires the response JSON to have a data array; if the parsed body is null or lacks Array.isArray(json.data), it throws this error naming the category, page, and the actual top-level keys received. It signals the API responded successfully but with an unexpected shape.

Solutions

  1. Log or inspect the raw response body for the failing URL (category + page are in the message) to see what keys came back
  2. Verify the category slug is valid — try https://www.getonbrd.com/api/v0/categories/{slug}/jobs in a browser or curl
  3. Check getonbrd.com API docs/changelog for a response-shape change and update normalizeGetonbrdJob/the provider accordingly
  4. A proxy or captive portal in the environment may be intercepting the request — test from another network
Defensive patterns

Strategy: try-catch

Validate before calling

// validate the endpoint before a full run:
const res = await fetch('https://www.getonbrd.com/api/v0/categories/programming/jobs?per_page=1&page=1');
const j = await res.json();
if (!j || !Array.isArray(j.data)) throw new Error('getonbrd feed shape changed — data[] missing');

Type guard

function isGetonbrdFeed(json) { return json != null && typeof json === 'object' && Array.isArray(json.data); }

Try / catch

try {
  const json = await ctx.fetchJson(url, { redirect: 'error' });
  if (!isGetonbrdFeed(json)) throw new Error(`getonbrd: unexpected shape, keys: ${Object.keys(json ?? {}).join(',')}`);
} catch (e) {
  console.error(`Category ${category} page ${page} failed: ${e.message} — inspect raw body and check for API schema changes`);
  break; // skip this category, continue scanning others
}

Prevention

When it happens

Trigger: The Get on Board API returns a non-feed payload — e.g. an error object {error: ...}, an HTML error page that still parsed as JSON oddly, a rate-limit JSON body, or an API version change reshaping the response — on any page of a category feed fetch.

Common situations: Get on Board changes their API schema; a category slug resolves but the endpoint returns a 200 with an error envelope; a proxy/WAF returns a JSON error body; per_page/page params stop being honored.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at providers/getonbrd.mjs:182

  async fetch(entry, ctx) {
    const categories = resolveCategories(entry);
    const maxPages = resolveMaxPages(entry);
    const fallbackCompany = entry?.name;
    const out = [];
    // A posting can appear under several categories; first sighting wins so the
    // scanner never sees the same URL twice from one entry.
    const seen = new Set();

    for (const category of categories) {
      const base = assertGetonbrdUrl(feedBase(category));

      for (let page = 1; page <= maxPages; page++) {
        const url = `${base}?per_page=${PER_PAGE}&expand[]=company&page=${page}`;
        // redirect:'error' prevents SSRF via server-side redirects
        const json = await ctx.fetchJson(url, { redirect: 'error' });
        if (!json || !Array.isArray(json.data)) {
          throw new Error(
            `getonbrd: unexpected API response for category "${category}" on page ${page} — expected { data: [...] }, got keys: [${json ? Object.keys(json).join(', ') : 'null'}]`,
          );
        }
        for (const j of json.data) {
          const normalized = normalizeGetonbrdJob(j, fallbackCompany);
          if (!normalized || seen.has(normalized.url)) continue;
          seen.add(normalized.url);
          out.push(normalized);
        }
        if (json.data.length < PER_PAGE) break; // short page → last page reached
      }
    }
    return out;
  },
};

View on GitHub (pinned to aac998c7ed)