{"record":{"id":"cd45c2a338f1cb25","repo":"musistudio/claude-code-router","slug":"gateway-cursor-sent-an-openai-compatible-chat-re","errorCode":null,"errorMessage":"[gateway] Cursor sent an OpenAI-compatible chat request with only user messages and no system/tools. Configure plugins[].id=\"cursor-proxy\" config.systemPrompt/config.tools to inject fallback context, or route Cursor native Agent traffic through the proxy.","messagePattern":"\\[gateway\\] Cursor sent an OpenAI-compatible chat request with only user messages and no system/tools\\. Configure plugins\\[\\]\\.id=\"cursor-proxy\" config\\.systemPrompt/config\\.tools to inject fallback context, or route Cursor native Agent traffic through the proxy\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/core/src/gateway/features/cursor-compat.ts","lineNumber":54,"sourceCode":"    body.messages = [\n      { content: context.systemPrompt, role: \"system\" },\n      ...(Array.isArray(body.messages) ? body.messages : [])\n    ];\n    changed = true;\n  }\n  if (context.tools.length > 0) {\n    body.tools = context.tools;\n    changed = true;\n  }\n  if (context.toolChoice !== undefined && context.tools.length > 0) {\n    body.tool_choice = context.toolChoice;\n    changed = true;\n  }\n\n  if (!changed) {\n    if (!warnedMissingCursorOpenAICompatContext) {\n      warnedMissingCursorOpenAICompatContext = true;\n      console.warn(\n        \"[gateway] Cursor sent an OpenAI-compatible chat request with only user messages and no system/tools. \" +\n        \"Configure plugins[].id=\\\"cursor-proxy\\\" config.systemPrompt/config.tools to inject fallback context, \" +\n        \"or route Cursor native Agent traffic through the proxy.\"\n      );\n    }\n    return { diagnostic: \"simplified-missing-context\" };\n  }\n\n  return {\n    body: serializeJsonBody(body),\n    diagnostic: \"fallback-injected\"\n  };\n}\n\n\nfunction isOpenAICompatChatCompletionsPath(path: string): boolean {\n  return path === \"/chat/completions\" ||\n    path === \"/v1/chat/completions\" ||","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/gateway/features/cursor-compat.ts#L36-L72","documentation":"The Cursor proxy plugin received an OpenAI-compatible chat request whose body contains only user messages with no system prompt or tools, indicating Cursor is sending a simplified request that lacks Agent context. The gateway warns once per process that fallback context should be injected via plugin config, or Cursor native Agent traffic should be routed through the proxy.","triggerScenarios":"Pointing Cursor at the gateway's OpenAI-compatible endpoint in a mode where it strips system prompts and tool definitions; using Cursor chat (not Agent) against the OpenAI-compat route; misconfiguring plugins[].id=\"cursor-proxy\" so no systemPrompt/tools are set.","commonSituations":"Switching Cursor from its native Agent mode to a custom OpenAI-compatible model; forgetting to configure config.systemPrompt and config.tools on the cursor-proxy plugin; Cursor version changes that drop system messages for custom models.","solutions":["Configure the cursor-proxy plugin with a systemPrompt and tools to inject fallback context: plugins: [{ id: \"cursor-proxy\", config: { systemPrompt: \"...\", tools: [...] } }]","Route Cursor's native Agent traffic through the proxy endpoint instead of the OpenAI-compatible chat endpoint","Update Cursor and the gateway so native Agent requests (which carry system/tools) are used"],"exampleFix":"// before\nplugins: [{ id: \"cursor-proxy\", config: {} }]\n\n// after\nplugins: [{\n  id: \"cursor-proxy\",\n  config: {\n    systemPrompt: \"You are a helpful coding agent with access to the repo.\",\n    tools: [/* minimal tool definitions */]\n  }\n}]","handlingStrategy":"validation","validationCode":"const hasContext = (body) =>\n  Boolean(body.messages?.some((m) => m.role === \"system\"?.content)) || Boolean(body.tools?.length);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always configure systemPrompt/tools on the cursor-proxy plugin","Monitor for the diagnostic 'simplified-missing-context' in responses","Keep Cursor on native Agent routing when possible"],"tags":["cursor","openai-compat","gateway","configuration"],"backgroundTag":"missing-request-context","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}