TypeError: Cannot read properties of undefined (reading 'length')

Steps to reproduce

  1. Activate vim navigation
  2. Open Dev Tools and see console
  3. go inside a table and navigate with vim

Did you follow the troubleshooting guide? [Y/N]

Yes, I tried in restricted mode and it happened too. That’s why I knew it’s not related to any plugins.

Expected result

No errors and no lag.

Actual result

I noticed it first as I had quite a lag in when navigating within my files. Usually, it’s blazingly fast. But I guess i narrowed it down to tables and vim mode.

Environment

Obsidian v.1.6.7
MacOS

vim.js:1006 TypeError: Cannot read properties of undefined (reading 'length')
    at t.lineInner (app.js:1:250274)
    at e.line (app.js:1:248273)
    at e.getLine (app.js:1:1137920)
    at clipCursorToContent (vim.js:3093:21)
    at Object.evalInput (vim.js:1709:23)
    at Object.processMotion (vim.js:1371:14)
    at Object.processCommand (vim.js:1346:18)
    at vim.js:999:37
    at e.operation (app.js:1:1146299)
    at vim.js:993:23
    at Object.handleKey (vim.js:864:18)
    at doKeyToKey (vim.js:1053:31)
    at vim.js:997:19
    at e.operation (app.js:1:1146299)
    at vim.js:993:23
    at Object.handleKey (vim.js:864:18)
    at Object.multiSelectHandleKey (vim.js:6237:28)
    at e.handleKey (app.js:1:1156852)
    at e.keydown (app.js:1:1157905)
    at app.js:1:375614
    at e.runHandlers (app.js:1:373670)
    at e.handleEvent (app.js:1:373432)
app.js:1 TypeError: Cannot read properties of undefined (reading 'length')
    at t.lineInner (app.js:1:250274)
    at e.line (app.js:1:248273)
    at e.getLine (app.js:1:1137920)
    at clipCursorToContent (vim.js:3093:21)
    at Object.evalInput (vim.js:1709:23)
    at Object.processMotion (vim.js:1371:14)
    at Object.processCommand (vim.js:1346:18)
    at vim.js:999:37
    at e.operation (app.js:1:1146299)
    at vim.js:993:23
    at Object.handleKey (vim.js:864:18)
    at doKeyToKey (vim.js:1053:31)
    at vim.js:997:19
    at e.operation (app.js:1:1146299)
    at vim.js:993:23
    at Object.handleKey (vim.js:864:18)
    at Object.multiSelectHandleKey (vim.js:6237:28)
    at e.handleKey (app.js:1:1156852)
    at e.keydown (app.js:1:1157905)
    at app.js:1:375614
    at e.runHandlers (app.js:1:373670)
    at e.handleEvent (app.js:1:373432)

Additional information

I made a video, but can’t upload unfortunately.

UPDATE: Also others had the same error, see Reddit. Their resolution didn’t work for me unfortunately.

Does it happen in the sandbox vault?

Can you provide a table to test with? I’m unable to reproduce the issue. Also is there any particular vim command/motion that’s triggering it? or does it just happen with h/j/k/l?

It happens with any table. E.g. this one I tried just now:

|            | *Transactional* | *Analytical* |
| ---------- | --------------- | ------------ |
| *Embedded* | SQLite          | **DuckDB**   |

No, it does not happen in the Sandbox. Any idea what the difference to my Vault could be to my vault with restricted mode (would guess should be the same) :thinking:

Try your vault with restricted mode on and default theme and restart obsidian.

I tried that:

I searched a bit more, and I also found others having the same behavior. It could also relate to key repeat speed, which I set to as low as possible on mac, so I can just press and stay for repeat.

But it is not related to vim I found, also happens when I use arrow keys. And what is the bad thing here, this worked for my last two years with no problem. So it must have come when I updated all my plugins lately (didn’t update for a long time) or with a newer Obsidian version, although I didn’t update at that particular time. Or my vault has hit a critical mass, but when I only open a singular note, I’d expect it doesn’t matter how big my vault is, it shouldn’t have lags. I also notice it’s mostly with longer markdown files that have links, tables, etc. But yeah, that is the whole purpose I use Obsidian.

I hope it will go away soon, I still haven’t found the culprit, but will certainly update when I have.

UPDATE: I found that the lag that initially made me investigate in searching the error is related to recalculate style. Most of the time is used doing that. I updated the installer version from 1.4.13 to the latest 1.6.7 (as I couldn’t export performance logs), but this didn’t solve the problem either. But the log and a screenshot of that Lag I added on Obsidian Cursor Cannot Keep Up with High Key Repeat Frequency - #16 by sspaeti. I hope that helps find the culprit.