{"record":{"id":"c27eae55fed12af6","repo":"diegosouzapw/OmniRoute","slug":"cursor-access-token-is-required-for-availablemodel","errorCode":null,"errorMessage":"Cursor access token is required for AvailableModels","messagePattern":"Cursor access token is required for AvailableModels","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/providerModels/cursorAvailableModels.ts","lineNumber":148,"sourceCode":"  for (const id of CURSOR_AUTO_ROUTER_VARIANT_IDS) {\n    if (byId.has(id)) continue;\n    const entry: CursorAgentModelEntry = {\n      id,\n      name: CURSOR_AUTO_ROUTER_VARIANT_NAMES[id],\n      owned_by: \"cursor\",\n    };\n    out.push(entry);\n    byId.set(id, entry);\n  }\n\n  return out;\n}\n\nexport async function fetchCursorAvailableModels(\n  options: FetchCursorAvailableModelsOptions\n): Promise<CursorAgentModelEntry[]> {\n  const { accessToken, signal } = options;\n  if (!accessToken) throw new Error(\"Cursor access token is required for AvailableModels\");\n\n  const machineId = options.machineId || (await getConsistentMachineId());\n  const cursorService = new CursorService();\n  const headers = {\n    ...cursorService.buildHeaders(accessToken, machineId),\n    // Prefer Connect JSON so we can parse without a protobuf schema\n    \"Content-Type\": \"application/json\",\n    Accept: \"application/json\",\n  };\n\n  const url = `${CURSOR_CONFIG.apiEndpoint}${CURSOR_CONFIG.modelsEndpoint}`;\n  const fetchImpl = options.fetchImpl || fetch;\n  const response = await fetchImpl(url, {\n    method: \"POST\",\n    headers,\n    body: \"{}\",\n    signal,\n  });","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/providerModels/cursorAvailableModels.ts#L130-L166","documentation":"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.","triggerScenarios":"Thrown at src/lib/providerModels/cursorAvailableModels.ts:148 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}