Assertion error when using custom editors incl. markdown preview editors

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):

  1. 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.
  2. 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:

Can you confirm whether the Keep option works on your side?