{"record":{"id":"04da978a8ac5f96c","repo":"vercel/ai","slug":"cursor-auth-json-stringify-auth-cannot-conf","errorCode":null,"errorMessage":"[cursor] auth: ${JSON.stringify(auth)} cannot configure Cursor provider authentication. ${detail} CURSOR_API_KEY is still required for Cursor CLI authentication.","messagePattern":"\\[cursor\\] auth: (.+?) cannot configure Cursor provider authentication\\. (.+?) CURSOR_API_KEY is still required for Cursor CLI authentication\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/harness-cursor/src/cursor-harness.ts","lineNumber":450,"sourceCode":"              Authorization: `Bearer ${env.CURSOR_API_KEY}`,\n            },\n          },\n        },\n      ];\n    },\n  });\n}\n\nfunction warnCursorAuthenticationConfiguration({\n  auth,\n}: {\n  auth: Exclude<ACPAuthenticationMode, 'auto'>;\n}): void {\n  const detail =\n    auth === 'ai-gateway'\n      ? \"Configure an AI Gateway API key as Cursor's OpenAI API key and set Override OpenAI Base URL to https://ai-gateway.vercel.sh/cursor/v1.\"\n      : 'Configure Cursor to use its direct model-provider routing.';\n  console.warn(\n    `[cursor] auth: ${JSON.stringify(auth)} cannot configure Cursor provider authentication. ${detail} CURSOR_API_KEY is still required for Cursor CLI authentication.`,\n  );\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n  return value != null && typeof value === 'object' && !Array.isArray(value);\n}\n","sourceCodeStart":432,"sourceCodeEnd":458,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/harness-cursor/src/cursor-harness.ts#L432-L458","documentation":"The Cursor harness detects that the chosen ACP authentication mode cannot be configured programmatically and prints a console warning. Only 'auto' can auto-configure; 'ai-gateway' or direct-routing modes require manual setup (Gateway key as Cursor's OpenAI key with the override base URL, or direct model-provider routing) while CURSOR_API_KEY is still needed for the Cursor CLI itself.","triggerScenarios":"createCursor called (or authentication mode resolved) with auth set to 'ai-gateway' or another non-auto ACPAuthenticationMode where the harness cannot inject provider credentials.","commonSituations":"Selecting auth: 'ai-gateway' without configuring Cursor's OpenAI API key/base URL manually; expecting the harness to provision Cursor auth from env vars; missing CURSOR_API_KEY for CLI login.","solutions":["Use auth: 'auto' so the harness configures authentication automatically","For 'ai-gateway': manually set Cursor's OpenAI API key to an AI Gateway key and set Override OpenAI Base URL to https://ai-gateway.vercel.sh/cursor/v1","Ensure CURSOR_API_KEY is set regardless of mode, since the Cursor CLI requires it","Follow the printed `detail` guidance for the specific mode"],"exampleFix":"// before\ncreateCursor({ authentication: 'ai-gateway' }); // warns, no auto setup\n// after\ncreateCursor({ authentication: 'auto' });\n// or keep 'ai-gateway' and manually set Cursor's OpenAI key + base URL https://ai-gateway.vercel.sh/cursor/v1","handlingStrategy":"validation","validationCode":"if (auth !== 'auto') {\n  console.warn('Non-auto Cursor auth requires manual provider setup and CURSOR_API_KEY');\n}","typeGuard":"function supportsAutoConfiguration(auth: string): boolean {\n  return auth === 'auto';\n}","tryCatchPattern":null,"preventionTips":["Default to authentication: 'auto' unless you need a specific mode","Always set CURSOR_API_KEY in the environment; it is required for the CLI regardless of provider auth","Document the manual steps (OpenAI key + base URL override) for ai-gateway mode in team setup guides"],"tags":["cursor","authentication","configuration","console-warning"],"backgroundTag":"provider-auth-not-configured","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}