hermes - 💡(How to fix) Fix write_file creates directory with literal backslash in path containing space

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

When using the write_file tool with a path that contains a space (e.g. ~/Documents/Obsidian Vault/file.md), the tool creates a directory with a literal backslash character instead of treating the space as a directory separator.

Root Cause

When using the write_file tool with a path that contains a space (e.g. ~/Documents/Obsidian Vault/file.md), the tool creates a directory with a literal backslash character instead of treating the space as a directory separator.

Fix Action

Fix / Workaround

Additional context

  • terminal + cat heredoc works correctly with the same paths
  • patch tool also has the same issue with space-containing paths
  • This has been confirmed across multiple write operations
RAW_BUFFERClick to expand / collapse

Bug: write_file creates directory with literal backslash in path containing space

Description

When using the write_file tool with a path that contains a space (e.g. ~/Documents/Obsidian Vault/file.md), the tool creates a directory with a literal backslash character instead of treating the space as a directory separator.

Steps to reproduce

  1. Invoke: write_file(path="~/Documents/Obsidian Vault/test.md", content="hello")
  2. The tool resolves the path to /Users/user/Documents/Obsidian\ Vault/test.md (with backslash)
  3. Instead of writing to the correct directory /Users/user/Documents/Obsidian Vault/test.md

Expected behavior

The tool should properly handle spaces in path components by:

  • Resolving ~ to the user's home directory
  • Treating backslash-space as an escaped space (i.e., breaking the path at the space, not treating backslash as a literal character)

Actual behavior

A directory named Obsidian\ Vault (with backslash in name) is created alongside the correct Obsidian Vault directory. Files are written to the wrong location.

Environment

  • Hermes Agent version: latest (bank-risk profile)
  • macOS 26.5.1
  • path passed with ~ expansion + escaped space

Additional context

  • terminal + cat heredoc works correctly with the same paths
  • patch tool also has the same issue with space-containing paths
  • This has been confirmed across multiple write operations

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The tool should properly handle spaces in path components by:

  • Resolving ~ to the user's home directory
  • Treating backslash-space as an escaped space (i.e., breaking the path at the space, not treating backslash as a literal character)

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING