CLI: stdout race condition causes harnesses like Claude Code to not pick up on certain heavy queries

Steps to reproduce

Requires a large-ish vault (~4k md files in my case).
Create a base with a complex filtering query. Example:
has_viewing: file.backlinks.map(value.asFile()).filter(value.properties.media.contains(file.asLink()) || value.properties.long_media.contains(file.asLink())).length > 0
Open vault in claude code, ask claude to query the view that uses that filter. Claude will not see the output.
You can verify outside of claude code, when running the query it should take a few seconds to generate the output.

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

Yes

Expected result

Claude Code should see the output.

Actual result

Claude does not see the output.

Environment

SYSTEM INFO:
Obsidian version: 1.12.1
Installer version: 1.8.3
Operating system: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6020 24.6.0
Login status: logged in
Language: en
Catalyst license: insider
Insider build toggle: on
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 2
Restricted mode: off
Plugins installed: 22
Plugins enabled: 20
1: Natural Language Dates v0.6.2
2: Paste URL into selection v1.11.4
3: Note Refactor v1.8.2
4: Linter v1.30.0
5: Dataview v0.5.68
6: Calendar v1.5.10
7: Templater v2.16.2
8: Tracker v1.17.0
9: Image Layouts v0.15.5
10: Mononote v1.2.2
11: Bulk Rename v0.5.2
12: Style Settings v1.0.9
13: Maps v0.1.6
14: Edge TTS v3.4.3
15: Relative Line Numbers v3.0.0
16: Heatmap Bases View v1.0.6
17: TaskNotes v4.3.0
18: Heatmap Calendar v0.7.1
19: Local Images Plus v0.16.4
20: Property Annotations v0.1.0

RECOMMENDATIONS:
Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.
Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.


Additional information

Claude’s conclusion after a debug session:

  • The backlink traversal formulas (file.backlinks.map(value.asFile()).filter(…)) take meaningfully longer to evaluate across hundreds/thousands of notes
  • The Obsidian CLI process signals exit (code 0) before stdout is fully flushed
  • Direct pipe capture closes when the process exits, losing the late-arriving JSON
  • Redirecting to a file captures everything because the filesystem write completes before cat reads it

The bug is in the Obsidian CLI: it doesn’t properly flush/await stdout before the process exits. It’s not a formula filter evaluation bug — it’s a stdout race condition that formula queries are more likely to trigger because they take longer to compute.

Workaround: obsidian base:query … > /tmp/out.txt 2>&1; cat /tmp/out.txt

Did you try with the latest installer ? (which would be 1.11.7)

As per the installations steps in the CLI doc you should have the 1.11.7 installer and Obsidian 1.12+ to access the CLI :woman_shrugging:

That’s fair, but no. I’ve since updated to the latest installer version and it makes no difference.

I’m sorry it didn’t help :pensive_face: