Skip to content

fix(obsidian): resolve headless renderer crash from Chrome 140 Fontations bug - #1460

Merged
shunkakinoki merged 2 commits into
mainfrom
fix/obsidian-headless-font-crash
Apr 12, 2026
Merged

fix(obsidian): resolve headless renderer crash from Chrome 140 Fontations bug#1460
shunkakinoki merged 2 commits into
mainfrom
fix/obsidian-headless-font-crash

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Apr 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix Obsidian headless service crash caused by Chrome 140's Fontations font indexer (NOTREACHED in remote_font_face_source.cc:357)
  • Add --disable-features=FontationsFontIndexer to fall back to FreeType
  • Install dejavu_fonts and fontconfig so the renderer has system fonts
  • Add ExecStartPre singleton lock cleanup to prevent stale locks on restart

Context

The Electron renderer was crashing because the server had zero fonts installed (fc-list returned 0). Chrome 140's new Rust-based Fontations font indexer calls GetLastResortFallbackFont() which returns nullptr with no fonts, triggering a fatal NOTREACHED. This prevented the obsidian-git plugin from ever executing.

Upstream: chromium#442747781, chromium#436609543

Test plan

  • Verify systemctl --user status obsidian shows active (running)
  • Verify obsidian-git plugin loads (gitReady: true) via CDP
  • Verify vault backup commits appear in wiki repo git log

Summary by cubic

Fixes the headless Obsidian crash on Chrome 140 by disabling the Fontations font indexer and installing system fonts. The service now starts reliably and the obsidian-git plugin can run.

  • Bug Fixes
    • Added --disable-features=FontationsFontIndexer to fall back to FreeType.
    • Installed dejavu_fonts and fontconfig so the renderer has fonts.
    • Clean up Obsidian Singleton lock files on start to prevent stale-lock crashes.
    • Set xvfb screen to 1280x1024x24 for stable rendering.

Written for commit c17408b. Summary will update on new commits.

…ions bug

Chrome 140's Fontations font indexer crashes with NOTREACHED in
remote_font_face_source.cc:357 when zero system fonts are installed.
This killed the Electron renderer, preventing obsidian-git from running.

- Add --disable-features=FontationsFontIndexer to bypass the buggy
  Rust font indexer and fall back to FreeType
- Add dejavu_fonts and fontconfig packages so the renderer has fonts
- Add ExecStartPre singleton lock cleanup to prevent stale locks
  from blocking service restarts
- Use larger xvfb screen (1280x1024x24) for better rendering
@mesa-dot-dev

mesa-dot-dev Bot commented Apr 12, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Apr 12, 2026

Copy link
Copy Markdown
📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Enhanced Obsidian service startup reliability by clearing coordination artifacts before initialization.
  • Chores

    • Added system font dependencies for improved text rendering support.
    • Updated virtual display configuration for better compatibility.
    • Optimized launcher with performance-focused feature adjustments.

Walkthrough

The Obsidian headless service setup adds font runtime dependencies and Xvfb screen configuration. A systemd pre-start cleanup step removes singleton coordination artifacts from the config directory before service startup.

Changes

Cohort / File(s) Summary
Service Configuration
home-manager/services/obsidian/default.nix
Extended package dependencies with dejavu_fonts and fontconfig. Added ExecStartPre cleanup step to remove Obsidian singleton lock/socket/cookie files from config directory before service start.
Launcher Script
home-manager/services/obsidian/obsidian-headless.sh
Updated headless Obsidian invocation with explicit Xvfb screen resolution (-s "-screen 0 1280x1024x24") and added --disable-features=FontationsFontIndexer flag.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 With fonts in place and singletons swept,
Obsidian's headless vigil is kept!
Pre-start cleanup before the dawn,
Artifacts vanish—let the service run on! 🖤

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: fixing an Obsidian headless renderer crash caused by Chrome 140's Fontations bug.
Description check ✅ Passed The description is directly related to the changeset, providing context about the Chrome 140 Fontations bug and explaining the fix including font installation and Fontations disabling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/obsidian-headless-font-crash

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mesa-dot-dev

mesa-dot-dev Bot commented Apr 12, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Fixed Obsidian headless service crash caused by a Chrome 140 Fontations font indexer bug.

What changed?

  • Added --disable-features=FontationsFontIndexer to fall back to FreeType
  • Installed dejavu_fonts and fontconfig for system fonts
  • Added ExecStartPre singleton lock cleanup to prevent stale locks on restart

Description generated by Mesa. Update settings

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the headless Obsidian service by adding font dependencies (dejavu_fonts, fontconfig), configuring Xvfb screen settings, and disabling the FontationsFontIndexer feature. It also introduces an ExecStartPre script to clean up Obsidian singleton lock files. Feedback was provided to ensure the configuration directory exists before the cleanup script runs to prevent potential execution failures.

Comment on lines +44 to +48
ExecStartPre = "${pkgs.writeShellScript "obsidian-pre" ''
rm -f ${config.xdg.configHome}/obsidian/SingletonLock
rm -f ${config.xdg.configHome}/obsidian/SingletonSocket
rm -f ${config.xdg.configHome}/obsidian/SingletonCookie
''}";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The ExecStartPre script will fail if the directory ${config.xdg.configHome}/obsidian does not exist (e.g., on a fresh installation or after a manual cleanup). This is because pkgs.writeShellScript enables set -e by default, and rm -f returns a non-zero exit code if a component of the path (the parent directory) is missing. Adding mkdir -p ensures the directory exists, and quoting the paths handles potential spaces in the configuration directory path.

      ExecStartPre = "${pkgs.writeShellScript "obsidian-pre" ''
        mkdir -p "${config.xdg.configHome}/obsidian"
        rm -f "${config.xdg.configHome}/obsidian/SingletonLock"
        rm -f "${config.xdg.configHome}/obsidian/SingletonSocket"
        rm -f "${config.xdg.configHome}/obsidian/SingletonCookie"
      ''}";

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
home-manager/services/obsidian/obsidian-headless.sh (1)

2-2: Add regression checks for the new launch arguments.

The current spec (spec/obsidian_headless_spec.sh:1-46) doesn’t assert -s "-screen 0 1280x1024x24" or --disable-features=FontationsFontIndexer, so these can regress silently.

Proposed spec additions
 Describe 'placeholder references'
@@
 It 'uses xvfb-run with auto-servernum flag'
 When run bash -c "grep '\\-a' '$SCRIPT'"
 The output should include '-a'
 End
+
+It 'sets explicit Xvfb screen geometry'
+When run bash -c "grep -- '-s \"-screen 0 1280x1024x24\"' '$SCRIPT'"
+The output should include '-screen 0 1280x1024x24'
+End
+
+It 'disables Fontations font indexer'
+When run bash -c "grep -- '--disable-features=FontationsFontIndexer' '$SCRIPT'"
+The output should include '--disable-features=FontationsFontIndexer'
+End
 End
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@home-manager/services/obsidian/obsidian-headless.sh` at line 2, The test
suite is missing assertions for the new launch args so regressions can slip by;
update spec/obsidian_headless_spec.sh to assert that the generated command line
from obsidian-headless.sh (the exec line using xvfb-run in obsidian-headless.sh)
includes the -s "-screen 0 1280x1024x24" option and the
--disable-features=FontationsFontIndexer flag (you can also assert --disable-gpu
if desired) by adding explicit string/regex checks against the produced command
or script content rather than only checking other flags.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@home-manager/services/obsidian/obsidian-headless.sh`:
- Line 2: The test suite is missing assertions for the new launch args so
regressions can slip by; update spec/obsidian_headless_spec.sh to assert that
the generated command line from obsidian-headless.sh (the exec line using
xvfb-run in obsidian-headless.sh) includes the -s "-screen 0 1280x1024x24"
option and the --disable-features=FontationsFontIndexer flag (you can also
assert --disable-gpu if desired) by adding explicit string/regex checks against
the produced command or script content rather than only checking other flags.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4d21d93e-7e49-468e-9fa8-2a4ab4412b39

📥 Commits

Reviewing files that changed from the base of the PR and between ef170d9 and c17408b.

📒 Files selected for processing (2)
  • home-manager/services/obsidian/default.nix
  • home-manager/services/obsidian/obsidian-headless.sh

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@shunkakinoki
shunkakinoki merged commit 4b98372 into main Apr 12, 2026
32 of 36 checks passed
@shunkakinoki
shunkakinoki deleted the fix/obsidian-headless-font-crash branch April 12, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant