silverbulletmd / silverbullet

The knowledge tinkerer's notebook
https://silverbullet.md
MIT License
2.62k stars 189 forks source link

Uncaught RangeError: Position 779 is out of range for changeset of length 778 #1109

Open Blackilykat opened 1 month ago

Blackilykat commented 1 month ago

I was adding an object to a page and suddenly i couldn't move my cursor anymore. I was in vim mode when this happened and the red highlighting wouldn't move but the edits would happen where they were supposed to. Switching vim mode off, I saw the same thing: cursor does not move but pressing the arrow keys and typing something would as expected.

When trying to edit the page nothing will save.

There's an error spammed in console, here's the full log:

``` b main.js:135:12 d main.js:148:11 replacement running main.js:157:11 Layout was forced before the page was fully loaded. If stylesheets are not yet loaded this may cause a flash of unstyled content. markup.js:250:53 Booting SilverBullet client in Online Mode boot.ts:8:10 Service worker registered... boot.ts:33:14 Rebuilding editor state client.ts:863:12 Loading plugs client_system.ts:197:12 (Re)loading plugs client_system.ts:200:12 alreadyFetching is on, skipping even triggering for fetchFileList. evented_space_primitives.ts:56:14 Activated plug markdown system.ts:161:12 Booting up worker for markdown worker_sandbox.ts:33:12 Activated plug template system.ts:161:12 Activated plug emoji system.ts:161:12 Activated plug plug-manager system.ts:161:12 Activated plug core system.ts:161:12 Activated plug editor system.ts:161:12 Activated plug index system.ts:161:12 Activated plug search system.ts:161:12 Activated plug federation system.ts:161:12 Activated plug share system.ts:161:12 Activated plug query system.ts:161:12 Activated plug sync system.ts:161:12 Activated plug tasks system.ts:161:12 Booting up worker for index worker_sandbox.ts:33:12 Booting up worker for template worker_sandbox.ts:33:12 Booting up worker for query worker_sandbox.ts:33:12 An exception was thrown as a result of invoking function lintYAML error: l is undefined index.plug.js:1:709 Error dispatching event editor:lint to index.lintYAML: l is undefined event.ts:72:28 Error: l is undefined onMessage worker_sandbox.ts:93 onmessage worker_sandbox.ts:59 init worker_sandbox.ts:45 init worker_sandbox.ts:44 invoke worker_sandbox.ts:107 invoke plug.ts:108 invokeFunction system.ts:104 _0t config.ts:67 WA config.ts:129 loadConfig client.ts:266 init client.ts:238 async* boot.ts:24 B2 async.ts:98 boot.ts:7 boot.ts:52 view.mjs:2:35279 Loaded 0 functions, 0 commands, 0 event handlers from space-script common_system.ts:54:16 Now navigating to Object { page: "External Drive Index", scrollTop: 0, selection: {…} } client.ts:476:14 Booting up worker for editor worker_sandbox.ts:33:12 Updating page list cache client.ts:751:12 YAML error unexpected end of the stream within a double quoted scalar (2:1) 1 | name: "Sandisk” 2 | -----^ index.plug.js:8:2161 Saving page External Drive Index client.ts:667:20 Flushed widget cache to store client.ts:1274:12 Uncaught RangeError: Position 779 is out of range for changeset of length 778 mapPos state.mjs:5 sm state.mjs:6 compare state.mjs:6 E_ view.mjs:3 update view.mjs:3 update view.mjs:4 dispatchTransactions view.mjs:4 dispatch view.mjs:4 kM view.mjs:3 setTimeout handler*kM view.mjs:3 blur view.mjs:3 runHandlers view.mjs:3 handleEvent view.mjs:3 ensureHandlers view.mjs:3 Xu view.mjs:4 init client.ts:198 async* boot.ts:24 B2 async.ts:98 boot.ts:7 boot.ts:52 state.mjs:5:5602 Uncaught RangeError: Position 779 is out of range for changeset of length 778 mapPos state.mjs:5 sm state.mjs:6 compare state.mjs:6 E_ view.mjs:3 update view.mjs:3 update view.mjs:4 dispatchTransactions view.mjs:4 dispatch view.mjs:4 kM view.mjs:3 setTimeout handler*kM view.mjs:3 focus view.mjs:3 runHandlers view.mjs:3 handleEvent view.mjs:3 ensureHandlers view.mjs:3 Xu view.mjs:4 init client.ts:198 async* boot.ts:24 B2 async.ts:98 boot.ts:7 boot.ts:52 state.mjs:5:5602 Uncaught RangeError: Position 779 is out of range for changeset of length 778 mapPos state.mjs:5 sm state.mjs:6 compare state.mjs:6 E_ view.mjs:3 update view.mjs:3 update view.mjs:4 dispatchTransactions view.mjs:4 dispatch view.mjs:4 select view.mjs:3 start view.mjs:3 mousedown view.mjs:3 runHandlers view.mjs:3 handleEvent view.mjs:3 ensureHandlers view.mjs:3 Xu view.mjs:4 init client.ts:198 async* boot.ts:24 B2 async.ts:98 boot.ts:7 boot.ts:52 state.mjs:5:5602 Uncaught RangeError: Position 779 is out of range for changeset of length 778 mapPos state.mjs:5 sm state.mjs:6 compare state.mjs:6 E_ view.mjs:3 update view.mjs:3 update view.mjs:4 dispatchTransactions view.mjs:4 dispatch view.mjs:4 kp editor_ui.tsx:67 setTimeout handler*kp/< editor_ui.tsx:66 kp editor_ui.tsx:65 init client.ts:195 async* boot.ts:24 B2 async.ts:98 boot.ts:7 boot.ts:52 state.mjs:5:5602 Uncaught RangeError: Position 779 is out of range for changeset of length 778 mapPos state.mjs:5 sm state.mjs:6 compare state.mjs:6 E_ view.mjs:3 update view.mjs:3 update view.mjs:4 dispatchTransactions view.mjs:4 dispatch view.mjs:4 select view.mjs:3 start view.mjs:3 mousedown view.mjs:3 runHandlers view.mjs:3 handleEvent view.mjs:3 ensureHandlers view.mjs:3 Xu view.mjs:4 init client.ts:198 async* boot.ts:24 B2 async.ts:98 boot.ts:7 boot.ts:52 state.mjs:5:5602 Uncaught RangeError: Position 779 is out of range for changeset of length 778 mapPos state.mjs:5 sm state.mjs:6 compare state.mjs:6 E_ view.mjs:3 update view.mjs:3 update view.mjs:4 dispatchTransactions view.mjs:4 dispatch view.mjs:4 select view.mjs:3 move view.mjs:3 M_ view.mjs:3 mousedown view.mjs:3 runHandlers view.mjs:3 handleEvent view.mjs:3 ensureHandlers view.mjs:3 Xu view.mjs:4 init client.ts:198 async* boot.ts:24 B2 async.ts:98 boot.ts:7 boot.ts:52 state.mjs:5:5602 Uncaught RangeError: Position 779 is out of range for changeset of length 778 mapPos state.mjs:5 sm state.mjs:6 compare state.mjs:6 E_ view.mjs:3 update view.mjs:3 update view.mjs:4 dispatchTransactions view.mjs:4 dispatch view.mjs:4 kp editor_ui.tsx:67 setTimeout handler*kp/< editor_ui.tsx:66 kp editor_ui.tsx:65 init client.ts:195 async* boot.ts:24 B2 async.ts:98 boot.ts:7 boot.ts:52 state.mjs:5:5602 Uncaught RangeError: Position 779 is out of range for changeset of length 778 mapPos state.mjs:5 sm state.mjs:6 compare state.mjs:6 E_ view.mjs:3 update view.mjs:3 update view.mjs:4 dispatchTransactions view.mjs:4 dispatch view.mjs:4 select view.mjs:3 start view.mjs:3 mousedown view.mjs:3 runHandlers view.mjs:3 handleEvent view.mjs:3 ensureHandlers view.mjs:3 Xu view.mjs:4 init client.ts:198 async* boot.ts:24 B2 async.ts:98 boot.ts:7 boot.ts:52 state.mjs:5:5602 Uncaught RangeError: Position 779 is out of range for changeset of length 778 mapPos state.mjs:5 sm state.mjs:6 compare state.mjs:6 E_ view.mjs:3 update view.mjs:3 update view.mjs:4 dispatchTransactions view.mjs:4 dispatch view.mjs:4 kp editor_ui.tsx:67 setTimeout handler*kp/< editor_ui.tsx:66 kp editor_ui.tsx:65 init client.ts:195 async* boot.ts:24 B2 async.ts:98 boot.ts:7 boot.ts:52 state.mjs:5:5602 Uncaught RangeError: Position 779 is out of range for changeset of length 778 mapPos state.mjs:5 sm state.mjs:6 compare state.mjs:6 E_ view.mjs:3 update view.mjs:3 update view.mjs:4 dispatchTransactions view.mjs:4 dispatch view.mjs:4 kM view.mjs:3 setTimeout handler*kM view.mjs:3 blur view.mjs:3 runHandlers view.mjs:3 handleEvent view.mjs:3 ensureHandlers view.mjs:3 Xu view.mjs:4 init client.ts:198 async* boot.ts:24 B2 async.ts:98 boot.ts:7 boot.ts:52 state.mjs:5:5602 ```

I uploaded the markdown file as it was when the error happened here

Manually changing the file to have an extra character at the end fixed the issue

mjf commented 1 month ago

I see 3 suspicious things. This is how the file in fact ends:

```#drive
name: "Sandisk”
  1. the code block is not ended
  2. the second quotation mark of the "Sandisk” is not an ASCII quotation mark but U+201D Right Double Quotation Mark Unicode Character
  3. the last EOL is missing