claude-code - 💡(How to fix) Fix [BUG] Bash tool cwd set to local plugin marketplace directory instead of invocation directory

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…

Fix Action

Workaround

Running cd /c/dev in the first Bash call corrects the session, but it's easy to miss that the cwd is wrong since the system prompt lists the correct primary working directory.

Code Example

{
     "extraKnownMarketplaces": {
       "my-marketplace": {
         "source": {
           "path": "C:\some-other-directory",
           "source": "directory"
         }
       }
     }
   }
RAW_BUFFERClick to expand / collapse

Bug Description

When a local directory plugin marketplace is configured in ~/.claude/settings.json via extraKnownMarketplaces, the Bash tool's shell session starts with its cwd set to that marketplace directory instead of the directory where claude was invoked.

Steps to Reproduce

  1. Configure a local plugin marketplace in ~/.claude/settings.json:
    {
      "extraKnownMarketplaces": {
        "my-marketplace": {
          "source": {
            "path": "C:\some-other-directory",
            "source": "directory"
          }
        }
      }
    }
  2. Open a terminal and cd C:\dev (or any directory)
  3. Run claude from that directory
  4. In the session, run the Bash tool with pwd

Expected Behavior

pwd should return /c/dev (the directory where claude was invoked).

Actual Behavior

pwd returns /c/some-other-directory (the local plugin marketplace path). The marketplace directory also appears as an "Additional working directory" in the session environment.

Impact

  • Any git commands run early in the session operate on the wrong repository
  • File paths are resolved relative to the wrong directory
  • The system prompt says "Primary working directory: C:\dev" but the shell is actually in the marketplace directory, creating a confusing inconsistency

Environment

  • Claude Code CLI (terminal invocation)
  • Windows 11
  • Shell: Git Bash (bash)
  • The marketplace directory (C:\axiomclaudemarket) is a git repo, which may be relevant to why it gets selected as cwd

Workaround

Running cd /c/dev in the first Bash call corrects the session, but it's easy to miss that the cwd is wrong since the system prompt lists the correct primary working directory.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Bash tool cwd set to local plugin marketplace directory instead of invocation directory