Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
I’m working on a Next.js 16 (Turbopack) project inside Cursor, and I consistently get 500 errors when accessing this route:
GET /api/leads/[leadId]/links
POST /api/leads/[leadId]/links
The UI always displays “Request failed”, and DevTools shows:
GET …/links → 500 (Internal Server Error)
POST …/links → 500 (Internal Server Error)
Sometimes preview shows only 1 or an empty body
Chrome reports: “Failed to load response data”
The API handlers and internal service functions are implemented correctly, but something in Cursor’s dev environment causes:
InMemoryLeadStore to reset between requests OR
params.leadId to become invalid OR
The API to return 500 before reaching my logic.
Additionally, the Cursor Dev Server terminal sometimes shows:
Error: Lead not found
Route “/api/leads/[leadId]/links” used ‘params’ as a Promise…
Even though the route file is using the correct Next.js 16 signature.
This only happens inside Cursor, not in a standard local Next.js environment.
Steps to Reproduce
Steps to Reproduce:
Open the project in Cursor
Run npm install and then npm run dev
Create a lead (works fine)
Open the lead → go to “Links” tab
Observe “Request failed” immediately
Try clicking “Add Link → Save Link”
Request still fails with 500
In Network tab:
GET /api/leads//links → 500
POST /api/leads//links → 500
Response Preview sometimes empty or just “1”
In terminal: error thrown before handler runs (“Lead not found”)
This issue only occurs in Cursor’s environment, not in normal local development.
Expected Behavior
Expected Behavior:
The route /api/leads/[leadId]/links should return the list of stored link attachments for a lead.
Adding a link should call the POST handler and save the data in the in-memory store.
The Links tab should load successfully and not show “Request failed”.
DevTools should show a valid JSON response instead of a 500 error.
Screenshots / Screen Recordings
Operating System
MacOS
Current Cursor Version (Menu → About Cursor → Copy)
Version: (copied from About Cursor)
VSCode Version: (copied from About Cursor)
Commit: (copied from About Cursor)
For AI issues: which model did you use?
Model used: GPT-5.1, GPT-4.1, Sonnet 3.5 (depending on the task)
Issue appears regardless of model selection.
For AI issues: add Request ID with privacy disabled
Request ID: (unable to retrieve — issue occurs outside AI messaging)
This is not an AI model hallucination issue — the problem happens in the integrated Next.js dev environment inside Cursor.
Additional Information
This bug blocks all API routes under /api/leads/[leadId]/links from functioning inside Cursor’s dev environment.
Even after ensuring correct Next.js 16 route handlers and fully resetting the project:
- GET /api/leads//links returns 500
- POST /api/leads//links returns 500
- Preview pane shows “Failed to load response data”
- Terminal intermittently prints “Lead not found” even when it exists
- Cursor shows “params must be unwrapped from a Promise” even when using correct Next.js 16 signature
This only happens when running the project inside Cursor.
Running the same project in a normal terminal outside Cursor works correctly.
I suspect Cursor Dev Server or TurboPack integration is corrupting dynamic route params or caching an invalid version of the in-memory store.
This breaks the entire “Links” feature of the CRM and prevents further development.
Does this stop you from using Cursor
No - Cursor works, but with this issue
