diegosouzapw/OmniRoute · error
Cursor access token is required for AvailableModels
Error message
Cursor access token is required for AvailableModels
What it means
fetchCursorAvailableModels requires an OAuth access token to call Cursor's AvailableModels endpoint; the caller passed a falsy accessToken in options. This is a missing-credential guard — the model catalog cannot be fetched anonymously, so discovery is aborted before any HTTP request is made.
Solutions
- Provide accessToken in FetchCursorAvailableModelsOptions
- Obtain a Cursor access token via the Cursor OAuth flow first
- Use the cursor-agent binary discovery path if no token is available
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/lib/providerModels/cursorAvailableModels.ts:148 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/c27eae55fed12af6.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/providerModels/cursorAvailableModels.ts:148
for (const id of CURSOR_AUTO_ROUTER_VARIANT_IDS) {
if (byId.has(id)) continue;
const entry: CursorAgentModelEntry = {
id,
name: CURSOR_AUTO_ROUTER_VARIANT_NAMES[id],
owned_by: "cursor",
};
out.push(entry);
byId.set(id, entry);
}
return out;
}
export async function fetchCursorAvailableModels(
options: FetchCursorAvailableModelsOptions
): Promise<CursorAgentModelEntry[]> {
const { accessToken, signal } = options;
if (!accessToken) throw new Error("Cursor access token is required for AvailableModels");
const machineId = options.machineId || (await getConsistentMachineId());
const cursorService = new CursorService();
const headers = {
...cursorService.buildHeaders(accessToken, machineId),
// Prefer Connect JSON so we can parse without a protobuf schema
"Content-Type": "application/json",
Accept: "application/json",
};
const url = `${CURSOR_CONFIG.apiEndpoint}${CURSOR_CONFIG.modelsEndpoint}`;
const fetchImpl = options.fetchImpl || fetch;
const response = await fetchImpl(url, {
method: "POST",
headers,
body: "{}",
signal,
});View on GitHub (pinned to a179ffed5b)