Create/Update .md files -- Unable to open: Assertion Failed: Argument is ‘undefined’ or ‘null’

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Cursor 2.0 often creates .md which cannot be opened in the IDE.

Unable to open ‘documentation.md’
Assertion Failed: Argument is ‘undefined’ or ‘null’

This disrupts my workflow quite a bit because I constantly make and update .md files. They are the “memory”.

I’m on Windows and don’t have any special add-ons or MCPs or anything.

I find if I open the doc before the agent updates, it’s less like to have an issue.

The agents I use are Sonnet 4.5 Thinking and Composer 1.0.

Steps to Reproduce

Ask the agent to create a .md file for documentation or planning.

Expected Behavior

The .md file should be openable in the IDE by clicking on it from the file explorer. This is very basic functionality.

Screenshots / Screen Recordings

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.0.38 (system setup)
VSCode Version: 1.99.3
Commit: 3fa438a81d579067162dd8767025b788454e6f90
Date: 2025-10-29T20:45:40.883Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.17763

For AI issues: which model did you use?

Sonnet 4.5 and Composer.

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

2 Likes

Thanks for the detailed bug report!

To help us debug this, could you please share:

  1. Open Help > Toggle Developer Tools and check the Console tab when the error appears - share any error messages you see there
  2. Can you open the problematic .md file using File > Open or in an external text editor (like Notepad)?
  3. Does this happen with all .md filenames or specific patterns (e.g., files with spaces, special characters)?
  4. What’s the file path where these .md files are being created?

Also, please try disabling extensions - they can cause unexpected file opening issues:

  • Run cursor --disable-extensions from command line
  • If .md files open correctly, re-enable extensions one by one to find the culprit or use Extension bisect

Thanks for the detailed bug report!

To help us debug this, could you please share:

  1. Open Help > Toggle Developer Tools and check the Console tab when the error appears - share any error messages you see there
  2. Can you open the problematic .md file using File > Open or in an external text editor (like Notepad)?
  3. Does this happen with all .md filenames or specific patterns (e.g., files with spaces, special characters)?
  4. What’s the file path where these .md files are being created?

Also, please try disabling extensions - they can cause unexpected file opening issues:

  • Run cursor --disable-extensions from command line
  • If .md files open correctly, re-enable extensions one by one to find the culprit or use Extension bisect

Thanks Sanjeed,
I love Cursor 2.0, but this “bug” is causing me pain because I make a .md for every page of my website. Below is an analysis (written in cursor, of course!)

Thank you for the follow-up. Here are the details and our findings.## Console errorsFrom Developer Tools > Console:

ERR Unable to retrieve document from URI ‘file:///d%3A/inetpub/wwwroot/askARTreact/docs/admin/reports/ad-reporting.md’: Error: Unable to retrieve document from URI ‘file:///d%3A/inetpub/wwwroot/askARTreact/docs/admin/reports/ad-reporting.md’

Lyu: Assertion Failed: Argument is undefined or null.

The error occurs when trying to open programmatically created markdown files immediately after creation.## External editorsYes, files open correctly in:- Notepad++

  • PowerShell (Get-Content)
  • VS Code (if installed)
  • Windows Notepad
    Files exist, have correct content and encoding, and are readable by other tools. The issue is Cursor-specific.## Filename patternsAffects all .md files created programmatically:- Files with spaces: MD file creation issue.md — fails if created programmatically
  • Files with hyphens: ad-reporting.md — fails if created programmatically
  • Simple names: test.md — fails if created programmatically
  • No special characters required; any programmatically created file fails
    Files manually created in Cursor (File > New) work immediately.## File pathsIssue occurs at:- D:\inetpub\wwwroot\askARTreact\docs\admin\reports\ad-reporting.md
  • D:\inetpub\wwwroot\askARTreact\docs\0 Common\Windows-File-Creation-Issue.md
  • Any path in the workspace where files are created programmatically

Extension testingTested with cursor --disable-extensions: issue persists. This appears to be a core Cursor IDE issue, not extension-related.## Root cause analysisAfter testing:1. Problem: Files created programmatically (via AI write tool, PowerShell, etc.) cannot be opened in Cursor immediately. They show:

  • “Unable to retrieve document from URI”
  • “Assertion Failed: Argument is ‘undefined’ or ‘null’”
  1. Workaround: Restarting Cursor IDE allows the files to open. This suggests a file system watcher cache issue.
  2. Solution found: Files manually created in Cursor (File > New, then save) open immediately and remain accessible. Populating those files programmatically works fine.
  3. Root cause hypothesis: Cursor’s Electron-based file system watcher on Windows is not registering programmatically created files. The watcher relies on OS-level file system events that may not fire for files created by external tools. Restarting forces a full file system rescan, which registers the files.
  4. Regression: This started after upgrading to Cursor 2.0. The previous version did not have this issue.

Evidence- Programmatically created files fail to open immediately

  • Same files open after Cursor restart
  • Same files open in external editors immediately
  • Manually created files work immediately
  • Issue affects all programmatically created .md files, regardless of filename pattern
  • Issue persists with all extensions disabled
  • Not related to file encoding, content, or permissions

RecommendationThis appears to be a regression in Cursor 2.0’s file system watcher. Please investigate:1. The file system watcher implementation on Windows

  1. How programmatically created files are registered
  2. Why manually created files are immediately accessible while programmatically created files are not
    The workaround (manual file creation) is functional but not ideal for workflows that rely on programmatic file creation.Please let me know if you need additional details or test cases.

| sanjeed5 Community Developer
October 31 |

  • | - |

Thanks for the detailed bug report!

To help us debug this, could you please share:

  1. Open Help > Toggle Developer Tools and check the Console tab when the error appears - share any error messages you see there
  2. Can you open the problematic .md file using File > Open or in an external text editor (like Notepad)?
  3. Does this happen with all .md filenames or specific patterns (e.g., files with spaces, special characters)?
  4. What’s the file path where these .md files are being created?

Also, please try disabling extensions - they can cause unexpected file opening issues:

  • Run cursor --disable-extensions from command line
  • If .md files open correctly, re-enable extensions one by one to find the culprit or use Extension bisect

Same here — I use Cursor to generate and update many Markdown files, and since the major update, I’ve been running into this issue every time after an agent update or when generating a Markdown file. As a workaround, I have to close the file, accept the changes blindly, and then reopen it. Cursor becomes practically unusable this way. Please fix it as soon as possible.

1 Like

Thanks for the details, I’ve passed it on to the team.

1 Like

I get this constantly, too!

Also observing this with markdown files. Very frustrating.

I think this might only affect markdown files created by the agent (?).

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Title: Markdown preview fails with “Assertion Failed” error after AI tool modifications


Description

Markdown files that are created or modified using Cursor’s AI assistant tools (write and search_replace) become unrenderable in Cursor’s markdown preview pane, showing an “Assertion Failed: Argument is undefined or null” error. The files remain valid markdown and can be opened in the raw markdown editor.

Symptoms

  • Error Message: “Assertion Failed: Argument is undefined or null
  • Location: Markdown preview pane when attempting to open .md files
  • Files Affected: Multiple markdown documentation files in a git-tracked workspace
  • Content: Files are syntactically valid markdown but fail to render in preview

Steps to Reproduce

Steps to Reproduce

  1. Open Cursor in a git-tracked workspace with markdown files
  2. Use AI assistant to create a new markdown file with the write tool
    • Example: Create docs/status/TEST-FILE.md with markdown content
  3. Attempt to open the file in Cursor’s markdown preview
  4. Result: “Assertion Failed” error appears instead of rendered preview

OR

  1. Have an existing, working markdown file in the workspace
  2. Use AI assistant’s search_replace tool to modify the file
  3. Attempt to reopen the file in Cursor’s markdown preview
  4. Result: File that previously worked now shows “Assertion Failed” error

Expected Behavior

Expected Behavior

Markdown files created or modified by Cursor’s AI tools should render normally in the markdown preview pane, just like manually edited files.

Actual Behavior

Files become corrupted in a way that prevents Cursor’s markdown preview from rendering them, even though:

  • The markdown syntax is valid
  • The files can be opened in the raw markdown editor
  • The files can be read by other markdown tools
  • Git shows valid, readable content

What We Tested (None of these fixed the issue)

  1. :cross_mark: Correcting markdown syntax errors (MD019, MD026, MD029)
  2. :cross_mark: Removing emojis and special characters
  3. :cross_mark: Removing extended file attributes (xattr -c file.md)
  4. :cross_mark: Recreating files from scratch using write tool
  5. :cross_mark: Creating files with OS cp command, then editing with search_replace (breaks after AI edit)
  6. :cross_mark: Restoring files from git history (git show commit:path > file)
  7. :cross_mark: Recreating files using terminal commands (cat, echo, heredocs)

Screenshots / Screen Recordings

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.0.63
Commit: 505046dcfad2acda3d066e32b7cd8b6e2dc1fdc0
Date: 2025-11-05T18:56:58.213Z
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Cursor/2.0.63 Chrome/138.0.7204.251 Electron/37.7.0 Safari/537.36

For AI issues: which model did you use?

claude-4.5-sonnet

Additional Information

Workarounds That DO Work

  1. :white_check_mark: Temporary fix: Open file → Click “Switch to Markdown Editor” → Close file → Reopen

    • File renders correctly after this sequence
    • Issue returns if file is modified by AI tools again
  2. :white_check_mark: Temporary fix: Clear Cursor cache

    # Close Cursor first, then:
    rm -rf ~/Library/Application\ Support/Cursor/Cache*
    rm -rf ~/Library/Application\ Support/Cursor/*Cache
    
    • All files render correctly after cache clear
    • Issue returns when AI tools modify files again

Key Observations

  1. Files created by OS tools initially work: Using cp to copy a working markdown file creates a working copy
  2. AI tool edits break files: Using search_replace on the copied file makes it unrenderable
  3. Git restore doesn’t fix: Even git show from clean history produces broken files
  4. Corruption is in Cursor’s metadata: The actual file content is valid markdown, suggesting Cursor’s internal file tracking/caching is corrupted

Environment

  • Operating System: macOS 24.6.0 (Sonoma)
  • Cursor Version: 2.0.63
  • Cursor Commit: 505046dcfad2acda3d066e32b7cd8b6e2dc1fdc0
  • Cursor Date: 2025-11-05T18:56:58.213Z
  • Electron: 37.7.0
  • Chrome: 138.0.7204.251
  • Workspace: Git-tracked repository
  • File Type: Standard markdown (.md) files
  • Shell: /bin/zsh

Affected Files

Multiple markdown documentation files in the docs/ directory became unrenderable after AI tool modifications. Example file docs/status/RESUME-HERE.md can be provided if needed for debugging.

Impact

  • Severity: Medium - Prevents normal usage of markdown preview feature
  • Workaround Available: Yes, but tedious (must manually fix each file)
  • Frequency: Consistent - happens every time AI tools modify markdown files
  • User Impact: Disrupts workflow, requires manual intervention to fix files

Additional Notes

This appears to be a bug in how Cursor’s AI tools (write, search_replace) interact with Cursor’s markdown preview metadata/caching system. The tools create or modify files in a way that Cursor’s preview can’t handle, even though the files are technically valid.

Hypothesis: The AI tools may be bypassing or not properly updating some internal Cursor file tracking/indexing mechanism that the markdown preview relies on.

Reproduction Reliability

:white_check_mark: Highly reproducible - Happened consistently across multiple sessions and multiple files

Does this stop you from using Cursor

No - Cursor works, but with this issue

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When i ask Cursor to make .md files, it doesn’t load most of them anymore.
Even if they are created.

Steps to Reproduce

All i did was update cursor to latest version, and then it stopped working, when i made projects, and asked it to make summary using .md

Expected Behavior

It should load the .md

Screenshots / Screen Recordings

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.0.43 (user setup)
VSCode Version: 1.99.3
Commit: 8e4da76ad196925accaa169efcae28c45454cce0
Date: 2025-10-30T18:49:27.589Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.26200

For AI issues: which model did you use?

Auto

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

whole of our company has the same iussue

1 Like

In my case, the issues comes from the “Office Viewer” extension, that bug only appeared since cursor 2.0.
To temporarily solve the issue:
Disable Office Viewer, reload extension, open file to confirm, then you can reactivate Office Viewer and reopen the file (if you really need that view)

Hopefully that can help someone

3 Likes

I’ll try this next time i make a project with .md :slight_smile:

This worked for me, thank you!

1 Like

Been an issue for me as well.
All started after the 2.0 update.

workbench.desktop.main.js:55   ERR Unable to retrieve document from URI 'file:///home/kwickell/code/Playpilot/n8n/memory-bank/activeContext.md': Error: Unable to retrieve document from URI 'file:///home/kwickell/code/Playpilot/n8n/memory-bank/activeContext.md'
	at uUt.getDocument (file:///usr/share/cursor/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:161:1748624)
	at nUt.$resolveCustomEditor (file:///usr/share/cursor/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:161:1736839)
	at i1e._doInvokeHandler (file:///usr/share/cursor/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:46:125366)
	at i1e._invokeHandler (file:///usr/share/cursor/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:46:125108)
	at i1e._receiveRequest (file:///usr/share/cursor/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:46:123822)
	at i1e._receiveOneMessage (file:///usr/share/cursor/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:46:122698)
	at Jae.value (file:///usr/share/cursor/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:46:120794)
	at J._deliver (file:///usr/share/cursor/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:2961)
	at J.fire (file:///usr/share/cursor/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:3282)
	at Do.fire (file:///usr/share/cursor/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:46:10994)
	at Jae.value (file:///usr/share/cursor/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:673:14540)
	at J._deliver (file:///usr/share/cursor/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:2961)
	at J.fire (file:///usr/share/cursor/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:3282)
	at Do.fire (file:///usr/share/cursor/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:46:10994)
	at MessagePortMain.<anonymous> (file:///usr/share/cursor/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:673:12739)
	at MessagePortMain.emit (node:events:519:28)
	at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:2949) Error: Unable to retrieve document from URI 'file:///home/kwickell/code/Playpilot/n8n/memory-bank/activeContext.md'

workbench.desktop.main.js:55   ERR cbu: Assertion Failed: Argument is `undefined` or `null`.
    at zg (vscode-file://vscode-app/usr/share/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:29:246)
    at ec (vscode-file://vscode-app/usr/share/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:29:1268)
    at pB.resolve (vscode-file://vscode-app/usr/share/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:4966:9286)
    at async jqe.setInput (vscode-file://vscode-app/usr/share/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:4965:10537)
    at async qzn.doSetInput (vscode-file://vscode-app/usr/share/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:810:63891)
    at async qzn.doOpenEditor (vscode-file://vscode-app/usr/share/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:810:61632)
    at async qzn.openEditor (vscode-file://vscode-app/usr/share/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:810:60557)
    at async vscode-file://vscode-app/usr/share/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:922:37085
    at async $Dt.value (vscode-file://vscode-app/usr/share/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:938:46814)

same problem here, i’m on Mac as well, is there a fix already ? it’s quite painful

worked, Cursor should display a better error message for debugging