Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug]: --dir and --bridge-script are not validated, so a bad path ends at the trust prompt or a "Bridge spawn failure"

Open Beginner friendly
#472 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
cli

Research direction

Start in Cli::validate() in src/lib.rs, where the -C/--dir and --bridge-script values arrive, and in inspect_bridge_script, which already produces the missing-script error. Reproduce with a nonexistent path and a plain file passed to -C, and confirm that the trust prompt and the projects entry in .claude.json happen after parsing. Done means both bad inputs exit 2 with a usage error naming the argument, before logging, trust or the bridge run, and that doctor is unchanged.

Written by the indexing model from the issue text.

Description

area: core help wanted type: bug
Description

Path arguments are checked only on use. A -C/--dir that is missing or a file still gets the trust prompt, saved trust, then a misleading SDK error. A missing --bridge-script exits 21 and suggests claude-rs doctor --strict, which passes: doctor checks the default script and takes no --bridge-script.

Steps to Reproduce

With a scratch CLAUDE_CONFIG_DIR:

  1. claude-rs -C /nonexistent/dir, choose Yes.
  2. claude-rs -C ./notes.txt (a file), choose Yes.
  3. claude-rs --bridge-script /nonexistent/bridge.js, then claude-rs doctor --strict
Expected Behavior

Each exits 2 with a usage error naming the argument; nothing is saved.

Actual Behavior
  1. /nonexistent/dir is added to projects in .claude.json, then exit 22 with Connection failed: agent stream failed: Claude Code native binary at .../claude exists but failed to launch. and a libc-mismatch hint. An existing directory connects.
  2. error=ENOTDIR: not a directory, posix_spawn '.../claude', exit 22.
  3. Bridge spawn failure
      detail: bridge script does not exist: /nonexistent/bridge.js: Agent bridge process failed to start
      exit_code: 21
      next_step: claude-rs doctor --strict
    
    doctor: 13 passed, 2 warnings, 0 failures, exit 0.
Version

claude-rs 0.15.2 (main at 70c04ef)

Operating System

macOS (Apple Silicon), macOS 27.2

Rust Version

rustc 1.89.0 (29483883e 2025-08-04)

Proposed approach

Check both in Cli::validate() (src/lib.rs), so a bad value is a usage error before logging, trust or the bridge: --dir must be a directory, and --bridge-script reuses the error inspect_bridge_script already produces. No SDK change. My fork has a version of this: https://github.com/ayush5harma/claude-code-rust/pull/32 (second commit).

Dominant language
Rust
Stars
261
Forks
57
Avg merge
10h 15m
Merged PRs (30d)
58

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from srothgan/claude-code-rust

All issues in srothgan/claude-code-rust

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.