AI agent loops on forbidden notebook tool and ignores stop signals in project

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

The AI coding agent repeatedly uses a forbidden notebook-editing tool (edit_notebook) on TypeScript files (.ts), despite explicit project rules that prohibit notebooks and Python.
After each failed notebook call (Failed to get notebook document), the agent does not stop or switch tools, but instead keeps calling the same tool many times, effectively entering a tool-call loop.
The agent also ignores explicit stop signals from the user (special files like STOP_NOTEBOOK, STOP_LOOP, STOP_NOW, ENOUGH, etc.) and continues trying the same failing notebook operation.
Because of this, the requested refactoring (extracting logic from length.ts into length/orientation.ts and other modules) is never completed, and the conversation gets flooded with repeated tool errors.

Steps to Reproduce

Open a TypeScript project in Cursor, for example with a large file like src/…ts.
Configure workspace / user rules that explicitly forbid:
using notebooks or Interpreter,
creating or editing .ipynb files.
Ask the AI agent (in agent mode) to refactor a large function by extracting logic into new TypeScript modules inside src/lib/…/ (e.g. orientation.ts).
Observe in the tool logs that the agent tries to call a notebook-editing tool (edit_notebook) on .ts files such as:
src/lib/…ts
and receives errors like:
Error calling tool: Failed to get notebook document: file:///…/src/lib/…ts
Create several stop-marker files in the project root (for example: STOP_NOTEBOOK, STOP_LOOP, STOP_NOW, ENOUGH, ENOUGH2, NO_MORE, LAST, REALLY_STOP, OK_STOP, dummy) and explicitly ask the agent to stop using notebook tools and to continue refactoring using normal file edits.
Ask the agent again to “continue” or “proceed” with the refactor and let it run for several more interactions.
Notice that the agent keeps trying the same edit_notebook tool on the same .ts files, despit

Expected Behavior

The agent should respect project rules and never use notebook tools for .ts files when notebooks are forbidden in the workspace.
On any repeated tool failure (such as Failed to get notebook document), the agent should either:
gracefully fall back to the correct file-editing API or to a “propose patch as text” mode in ask/read-only mode, or
stop and clearly report that it cannot perform edits in the current mode, instead of looping on the same failing tool.
When the user explicitly asks to stop using notebooks and creates stop-marker files, the agent should recognize these stop signals, avoid notebook-related tools, and continue the refactoring using only allowed mechanisms.

Screenshots / Screen Recordings

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

AutoVersion: 2.1.47 (user setup)
VSCode Version: 1.105.1
Commit: 2d3ce3499c15efd55b6b8538ea255eb7ba4266b0
Date: 2025-12-04T02:31:50.567Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.26200

For AI issues: which model did you use?

Auto

Additional Information

This is reproduced daily half of the day for sure completely blocks the work does not give edit files to the cursor constantly creates files with Python and is linked to a laptop. The cursor is completely removed extension related to Python, Notebook and Jupyter. And this is constantly reproduced with the auto model and some other models, but not all of them. I turned off all the settings to the cursor related to Notebook and Jupiter

Does this stop you from using Cursor

Yes - Cursor is unusable

All files are created as a call for help from the cursor from AI

ms-toolsai.jupyter

For the purity of the experiment, I put an extension to check if there are any updates in it to fix this bug but the miracle did not happen, The cursor makes a mistake any request with any command to edit files

Now Turn off whis extension. Be wait for answer

Hey, thanks for the report. I see multiple start/failed calls for edit_notebook and ConnectError: [aborted].

Need data for the engineers:

  • 2-3 Request IDs from the problematic session (Chat menu → Copy Request ID)
  • Export of the problematic chat: Export | Cursor Docs
  • Full DevTools Console log (from task start to looping)
  • Text of your rules (.cursor/rules and/or AGENTS.md) and rule types (Always/Apply Intelligently/Specific Files)
  • List of exact models where the bug occurs/doesn’t (with explicit model selection, not Auto)
  • Result of running: cursor --disable-extensions (does it reproduce?)

Once you send the Request ID + export/logs/rules, I’ll pass it to the team.

4b9fa86f-9df0-4da8-b249-adede5d5312e

421a10dd-a367-4a3f-9082-f414b1afddba

cursor_.7z (63,4 КБ)

The error went away for a while, but for the last two days it hasn’t let me work at all.
It just keeps generating files and can’t edit the code.

extensions jupyter delet from project

Thank you for the request ID and chat export. I see the problem is back and completely blocking work.

For passing to engineers, could you provide the remaining data:

  1. DevTools Console log (Help > Toggle Developer Tools > Console tab):

    • Copy the entire output from the start of the task until looping
  2. Rules files:

    • Contents of .cursor/rules and/or AGENTS.md
  3. Test with specific models:

    • Try with explicitly selected models (not Auto): claude-4.5-sonnet, gpt-5
    • Which model reproduces it, which doesn’t?
  4. Test without extensions:

    • Result of command: cursor --disable-extensions
    • Does the problem reproduce?
  1. load log.txt

    logs.txt (243,3 КБ)

    b0e14336-77da-4460-a9b2-34bcb1deb34f - request id

  2. conventions.zip (2,6 КБ)

  3. Auto

  4. Yes, reproduce. The problem lasts the entire workday and then goes away on its own and returns again. And it happens every day.

1 Like

Same problem here.

Cursor + LM Studio + Qwen 2.5 coder 14b

tried multiple models, always get the error “failed to get notebook document”

can’t believe this is the only google result for “failed to get notebook document”?

I also get the “notebook document’” garbage