Skip to content

Guard JSON parsing in Ashby fetcher against non-JSON responses#4

Draft
Copilot wants to merge 2 commits intocodex/integrate-ashby-job-ingestion-strategyfrom
copilot/sub-pr-2-again
Draft

Guard JSON parsing in Ashby fetcher against non-JSON responses#4
Copilot wants to merge 2 commits intocodex/integrate-ashby-job-ingestion-strategyfrom
copilot/sub-pr-2-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 11, 2026

Ashby API can return non-JSON responses (HTML error pages) even with 200 OK, causing response.json() to throw and halt the entire ingestion pipeline.

Changes

  • Wrapped JSON parsing in try/catch to isolate parse failures
  • Log slug and status code on parse errors for debugging
  • Return empty array on failure to allow processing remaining companies
try {
  const result: AshbyPublicResponse = await response.json();
  const postings = result.jobs ?? [];
  return postings.map((posting) => ({ company: companyName, slug, posting }));
} catch (error) {
  log('fetch', 'error', `  Failed to parse JSON for ${slug} (status ${response.status}): ${error}`);
  return [];
}

One malformed response no longer stops Step 1 execution.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…bad response from stopping ingestion

Co-authored-by: Mayank-glitch-cpu <85422185+Mayank-glitch-cpu@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Ashby slug pool and slug verification utility Guard JSON parsing in Ashby fetcher against non-JSON responses Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants