Skip to content

Bug: Project path incorrectly reconstructed when username contains underscores — causes "Failed to send prompt" #465

@mikesmichal

Description

@mikesmichal

Bug Description

When a system username contains an underscore (e.g. michal_mikes), opcode reconstructs project paths incorrectly, causing "Failed to send prompt" on every prompt submission in the Projects view.

Root Cause

Claude CLI encodes project paths into directory names under ~/.claude/projects/ by replacing both / and _ with -. For example:

/home/michal_mikes/projects  →  -home-michal-mikes-projects

When opcode reads this directory name and reconstructs the original path, it only performs the reverse of /-, yielding:

-home-michal-mikes-projects  →  /home/michal/mikes/projects   ❌

The underscore in the username is lost, producing a path that does not exist on disk. Claude CLI then fails to start because the working directory is invalid, and opcode surfaces this as "Failed to send prompt".

The correct path should be /home/michal_mikes/projects

Steps to Reproduce

  1. Use a Linux/macOS system where the username contains an underscore (e.g. john_doe)
  2. Open opcode and navigate to the Projects tab
  3. Select any project
  4. Type any prompt and press Enter

Result: "Failed to send prompt" error immediately.

Workaround

Manually fix the corrupted projectPath values in opcode's localStorage SQLite database:

~/.local/share/opcode.asterisk.so/localstorage/tauri_localhost_0.localstorage

Values are UTF-16LE encoded JSON. Replace occurrences of /home/john/doe/ with /home/john_doe/ in the projectPath fields.

Expected Behavior

The path reconstruction from the Claude project directory name should either:

  • Read the cwd field directly from the session .jsonl files inside the project directory (which contain the correct original path), or
  • Use a reversible encoding that distinguishes / from _ (e.g. encode only / as - and leave _ as-is, or use a different separator)

Environment

  • OS: Ubuntu 22.04 LTS
  • opcode version: 0.2.0
  • Claude Code version: 2.1.139
  • Username: contains underscore

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions