Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Summary
Markdown files created or modified by AI agents (using the write tool OR shell commands executed by agents) cause Cursor to either:
- Fail to open with error: “Assertion Failed: Argument is
undefinedornull” - Open but display as blank (content exists when viewed in other editors)
CRITICAL FINDING: Even files created via shell commands (heredoc, cat) fail to open when created from within Cursor’s agent execution context, suggesting the issue is broader than just the write tool.
Environment
- OS: macOS (darwin 25.2.0)
- Editor: Cursor
- File Type: Markdown (.md files)
- Trigger: Files created/modified by AI agent tools OR shell commands executed by agents
Detailed Symptoms
Symptom 1: Null/Undefined Error
- Error Message: “Unable to open ‘[filename].md’” followed by “Assertion Failed: Argument is
undefinedornull” - Occurs: When attempting to open files created with:
- The
writetool - Shell commands executed by AI agents (cat, heredoc, etc.)
- The
- Example Files:
test_write_tool.md(created via AI agentwritetool)CURSOR_BUG_REPORT.md(created via shell heredoc from within agent context)
- Status: File cannot be opened in Cursor at all
Symptom 2: Blank Display
- Symptom: File opens in Cursor but appears completely blank
- Reality: File contains valid content (verified via terminal, TextEdit, and other editors)
- Example File:
untitled.md(modified via AI agentsearch_replacetool) - Status: File opens but content is invisible in Cursor
Test Results
Files That Work Correctly 
All created via shell commands executed OUTSIDE of Cursor’s agent context:
test_manual.md- Created withechocommand (manual)test_no_newline.md- Created withprintfcommand (manual)test_write_tool_fixed.md- Created with shell heredoc (manual)
Files That Fail 
Created/modified via AI agent tools OR shell commands executed WITHIN agent context:
test_write_tool.md- Created withwritetool → Throws null errorCURSOR_BUG_REPORT.md- Created with shell heredoc (from agent) → Throws null erroruntitled.md- Modified withsearch_replacetool → Displays blank
Technical Analysis
File Integrity Verification
All failing files pass standard file integrity checks:
Valid text encoding (ASCII or UTF-8)
Proper file permissions (-rw-r--r--)
Correct line endings
Content verified via cat,hexdump,filecommands
Opens correctly in TextEdit and other editors
File Comparison
test_write_tool.md(fails) vstest_write_tool_fixed.md(works) are byte-for-byte identical- Same content, same encoding, same permissions
- Only difference: creation method (AI tool vs manual shell command)
Key Finding: Execution Context Matters
The critical discovery: Files created via shell commands work when created manually, but FAIL when the same shell commands are executed by AI agents from within Cursor. This suggests:
- The issue is NOT specific to the
writetool - Cursor may have problems with files created by processes spawned from its agent execution context
- Cursor’s file watcher may not properly handle files created by child processes
- There may be a race condition or metadata issue when files are created while Cursor is actively monitoring the directory
Extended Attributes
- All files have
com.apple.provenanceattribute (normal for macOS) untitled.mdadditionally hascom.apple.lastuseddate#PSandcom.apple.macl(suggesting it was opened before)
Steps to Reproduce
Reproduction Steps
- Have an AI agent create a new markdown file using either:
- The
writetool, OR - Shell commands (cat, heredoc, echo, etc.)
- The
- Attempt to open the file in Cursor
- Result: Either get null error or file opens blank
Note: The same shell commands work fine when executed manually outside of agent context.
Expected Behavior
Open a markdown file which was created or modified by an agent.
Operating System
MacOS
Current Cursor Version (Menu → About Cursor → Copy)
Version: 2.2.43
VSCode Version: 1.105.1
Commit: 32cfbe848b35d9eb320980195985450f244b3030
Date: 2025-12-19T06:06:44.644Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.2.0
Additional Information
Workarounds
- For new files: Create files manually first (outside Cursor or before agent execution), then have AI agents edit them
- For existing files: Use
search_replaceon files that already exist (though this can still cause blank display issue) - Recovery: Files can be recovered by opening in TextEdit or other editors, then copying content to a new file
- For bug reports: Create markdown files manually outside of Cursor before opening
Impact
- Severity: High - Data loss risk (files appear blank, user may think content is lost)
- Frequency: Consistent - Happens every time AI agents create/modify markdown files
- User Impact: Cannot reliably use AI agents to create or modify markdown files in Cursor
- Scope: Affects both
writetool AND shell commands executed by agents
Requested Fix
Please investigate:
- How Cursor handles files created by processes spawned from its agent execution context
- Why identical file content works when created manually but fails when created by agent-executed processes
- Why files modified via
search_replacedisplay as blank despite containing valid content - Whether there’s a file metadata cache that needs to be invalidated
- Whether Cursor’s file watcher properly handles files created by child processes
- If there’s a race condition between file creation and Cursor’s file system monitoring
Additional Context
This issue occurs consistently across multiple projects, suggesting it’s a systematic problem with how Cursor processes files created/modified by AI agent tools or processes spawned by agents, not an isolated incident.
Meta Note: Multiple versions of this bug report were created using different methods (write tool, shell heredoc from agent) and ALL failed to open, perfectly demonstrating the bug being reported!
Report Generated: 2025-12-20 Test Files Available: All test files remain on Desktop for inspection Encoding Note: Some failing files are UTF-8, some are ASCII - encoding does not appear to be the root cause
Does this stop you from using Cursor
No - Cursor works, but with this issue