Hey, thanks for the report. This is a known issue with initializing the document state for AI-created files.
The team is already working on a fix. The bug showed up after Cursor 2.0 and affects custom editors (CustomTextEditorProvider) and the Markdown preview. The issue is that Cursor doesn’t fully initialize the TextDocument for AI-created files until you open it in the text editor at least once.
Workaround (2 options):
- Click Keep on the AI-created file in the review panel before opening it in your custom editor. Based on your observation D, this should fix it.
- If the file is already created, open it once in the text editor (right-click → Open With → Text Editor). After that, the custom editor should work.
Related threads:
- Create/Update .md files -- Unable to open: Assertion Failed: Argument is ‘undefined’ or ‘null’ same issue with Markdown preview (34 posts, lots of confirmations)
- Draw.io Integration Plugin Fails with Custom Editor API Error similar error with the Draw.io extension
Can you confirm whether the Keep option works on your side?