Cannot read properties of undefined (reading 'setCssClass') (frontmatter issue?)

What I’m trying to do

After updating to the latest release, Obsidian failed to open all of my files except for canvas. The error message says: Failed to load ‘’<filename.md>‘’. Cannot read properties of undefined (reading ‘setCssClass’).

Almost all of my notes have frontmatter such as

---
aliases:
updated: 
created: 
tags: 
status: 
---

Here’s the error from Console

TypeError: Cannot read properties of undefined (reading 'setCssClass')
    at t.loadFrontmatter (app.js:1:2087082)
    at t.setViewData (app.js:1:2087881)
    at t.setData (app.js:1:1823571)
    at t.<anonymous> (app.js:1:1823474)
    at app.js:1:237030
    at Object.next (app.js:1:237135)
    at a (app.js:1:235853)

Things I have tried

I have turned on Restricted mode and I am using only the default style. Also tried reinstalling previous releases and restarted my laptop. Still the same error message. Please help! Thanks!

I don’t know what that means, but you might try copying your notes (without the .obsidian folder) into a new vault to see if that helps.

I have the same issue.

I worked through everything and tracked it down my issue to the app.json and ultimately it was the legacy editor setting.

I don’t remember why I enabled legacy editor, but once I turned off Settings >> Editor >> Use Legacy Editor and restarted everything worked again.

I guess the method for showing frontmatter using the legacy editor is broken in the newer vetsion.

2 Likes

I also saw this and it’s really unfortunate, because I’m not a fan of the new editor. I want to have the source editor just being a plain editor. Not showing bigger fonts if it’s #### and so on. That should only be in the Live Preview view. Give me a plain monspaced editor.

1 Like

Give this snippet a spin. You can use the entire thing or pick out pieces that you’d like. It’s still missing a few edge cases, but it’s fairly barebones. :xray:

1 Like

Thx! How do I get the font smaller and another color though? I would like to have it the same as the metadata like creation date and modification date.

For the body font and size, add color and font-size to this section

/*- monospace font for source mode -*/
.markdown-source-view:not(.is-live-preview) .cm-scroller {
    --font-text: 'JetBrains Mono', var(--font-monospace);
    color: blue;
    font-size: 14px; }

You may need to add color in other places to take care of code blocks, callouts, etc. If you have any other questions, feel free to @ me in the MarkGone thread so we don’t clutter this one up. :potted_plant:

that worked for me, thx

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.