santifer/career-ops · error · Error
glints: unexpected API response — ${JSON.stringify(json).sli
Error message
glints: unexpected API response — ${JSON.stringify(json).slice(0, 200)} What it means
glints.mjs throws this on page 1 of fetch() when json.data.searchJobsV3.jobsInPage is not an Array. The Glints GraphQL contract is { data: { searchJobsV3: { jobsInPage: [...], hasMore, expInfo } } }, so a missing/reshaped searchJobsV3 means the schema moved or the query failed to select the right fields. (On later pages this condition breaks the loop instead of throwing, so this specific throw is page-1 only.) The message embeds the first 200 chars of the response for diagnosis.
Source
Thrown at providers/glints.mjs:229
CountryCode: country,
includeExternalJobs: true,
pageSize: pageSize,
page: page,
},
};
let json;
try {
json = /** @type {any} */ (await graphqlPage(apiUrl, query, variables, ctx));
} catch (err) {
if (page === 1) throw err;
console.error(`glints: page ${page} fetch failed — ${err.message}`);
break;
}
const jobsInPage = json?.data?.searchJobsV3?.jobsInPage;
if (!Array.isArray(jobsInPage)) {
if (page === 1) throw new Error(`glints: unexpected API response — ${JSON.stringify(json).slice(0, 200)}`);
break;
}
if (jobsInPage.length === 0) break;
for (const item of jobsInPage) {
const job = parseGlintsItem(item, baseUrl, fallbackCompany);
if (job) allJobs.push(job);
}
// Stop if no more pages
if (json?.data?.searchJobsV3?.hasMore === false) break;
if (jobsInPage.length < pageSize) break;
// Rate-limit courtesy delay
await new Promise(resolve => setTimeout(resolve, 300));
}
View on GitHub (pinned to 9b17a8ac97)
Solutions
- Inspect the 200-char JSON snippet in the message — if it shows a top-level errors[] or a renamed field, that is the cause.
- If entry.graphqlQuery is set, ensure it selects data.searchJobsV3.jobsInPage; otherwise remove graphqlQuery to use the maintained DEFAULT_GRAPHQL_QUERY.
- Re-capture the live searchJobsV3 query from glints.com and update DEFAULT_GRAPHQL_QUERY (and the jobsInPage/hasMore extraction) to match.
- Verify countryCode/searchKeywords are valid; an invalid CountryCode can return an unexpected envelope.
Example fix
# before (custom query selects wrong field)
- name: Glints (ID)
provider: glints
graphqlQuery: "query { opportunities { jobs { id title } } }"
# after (omit to use maintained default, or select jobsInPage)
- name: Glints (ID)
provider: glints
# graphqlQuery removed -> uses DEFAULT_GRAPHQL_QUERY Defensive patterns
Strategy: type-guard
Type guard
// Narrow a Glints GraphQL response to the expected searchJobsV3.jobsInPage shape.
function isGlintsJobsPage(json) {
return !!json && typeof json === 'object'
&& json.data && typeof json.data === 'object'
&& json.data.searchJobsV3 && typeof json.data.searchJobsV3 === 'object'
&& Array.isArray(json.data.searchJobsV3.jobsInPage);
} Try / catch
// On page 1 throw (schema regression); on later pages, stop paginating.
try {
json = await graphqlPage(apiUrl, query, variables, ctx);
} catch (err) {
if (page === 1) throw err;
console.error(`glints: page ${page} failed — ${err.message}`);
break;
}
if (!isGlintsJobsPage(json)) {
if (page === 1) throw new Error(`glints: unexpected API response — ${JSON.stringify(json).slice(0, 200)}`);
break;
} Prevention
- Avoid overriding graphqlQuery unless you also select data.searchJobsV3.jobsInPage.
- Re-capture the live searchJobsV3 query when Glints ships a schema change and update DEFAULT_GRAPHQL_QUERY promptly.
- Log the 200-char response snippet on shape failures so regressions are diagnosed from one run.
When it happens
Trigger: Glints renamed searchJobsV3 or jobsInPage in a schema bump; the query was overridden via entry.graphqlQuery with an operation that returns a different shape; the server returned a top-level errors[] (no data) for an invalid query; a partial/empty 200 with data:null.
Common situations: Glints ships the reverse-engineered schema change the file header warns about; operator sets graphqlQuery to a custom string that does not select jobsInPage; a variables mismatch (bad CountryCode/SearchTerm) yields a degenerate response.
Related errors
- flowxtra: unexpected API response on page ${page} — expected
- gem: JobBoardList failed: ${listResult.errors[0]?.message ||
- getonbrd: unexpected API response on page ${page} — expected
- glints: HTTP ${err.status} — ${detail}
- ${msg}
AI-assisted analysis of santifer/career-ops@9b17a8ac97 (2026-08-13).
Data as JSON: /api/errors/fd09629e69607f5b.
Report an issue: GitHub.