Custom editor retains previous error on reopen even when it no longer applies
#268301 opened on Sep 25, 2025
Description
Type: Bug
When I try to open a custom text editor which previously failed to open because file couldn't be read on disk (I invoke opening of the custom editor by vscode.open command so it is easily possible to pass in URI to file that does not exist) every attempt fails with the same "The editor could not be opened because the file was not found." error even if the file was created in the meantime.
Repro steps
- clone https://github.com/vaclavHala/vscode-stale-custom-editor-error
- run repro extension from vscode
- run command
Hello World
Expected
When custom editor is reopened second time it shows the actual editor because the backing file was created on disk in the meantime
Actual
It still opens the placeholder saying "The editor could not be opened because the file was not found.". Even if I click the Try Again action it still claims the file does not exist.
After a bit of debugging of vscode itself I think the problem lies here https://github.com/microsoft/vscode/blob/3bf92e795ffd1ef7c3ff38a774d2bdb1a747e0a6/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.ts#L45 the entry.model promise is already rejected from before and it is just blindly rethrown every time
VS Code version: Code 1.104.1 (0f0d87fa9e96c856c5212fc86db137ac0d783365, 2025-09-17T23:36:24.973Z) OS version: Linux x64 6.1.0-18-amd64 Modes:
| Item | Value |
|---|---|
| CPUs | AMD Ryzen 7 2700 Eight-Core Processor (16 x 1538) |
| GPU Status | 2d_canvas: enableddirect_rendering_display_compositor: disabled_off_okgpu_compositing: enabledmultiple_raster_threads: enabled_onopengl: enabled_onrasterization: enabledraw_draw: disabled_off_okskia_graphite: disabled_offtrees_in_viz: disabled_offvideo_decode: enabledvideo_encode: disabled_softwarevulkan: disabled_offwebgl: enabledwebgl2: enabledwebgpu: disabled_offwebnn: disabled_off |
| Load (avg) | 1, 1, 2 |
| Memory (System) | 31.29GB (18.75GB free) |
| Process Argv | --crash-reporter-id 30accd57-4487-4ba7-ac0a-898cfb0f097e |
| Screen Reader | no |
| VM | 0% |
| DESKTOP_SESSION | lightdm-xsession |
| XDG_CURRENT_DESKTOP | XFCE |
| XDG_SESSION_DESKTOP | lightdm-xsession |
| XDG_SESSION_TYPE | x11 |
vsliv368:30146709
pythonvspyt551:31249599
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
471b6256:31263136
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
6518g693:31334701
aj953862:31281341
cs4_fixed:31391938
82j33506:31327384
nes-set-on:31351930
testaa123cf:31335227
6abeh943:31336334
0cj2b977:31352657
gaj49834:31362110
cloudbuttont:31379625
todos-1:31390405
treatment_gpt5applypatchexclusively:31392058
3efgi100_wstrepl:31382709
metis-embeddings:31388492
trigger-command-fix:31379601
auto_model_enabled:31385282
use-responses-api:31390855