gemini-cli - 💡(How to fix) Fix VS Code + WSL: Gemini writes files to the wrong project/workspace [1 participants]

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…
GitHub stats
google-gemini/gemini-cli#25527Fetched 2026-04-17 08:55:43
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
2
Participants
Timeline (top)
labeled ×2
RAW_BUFFERClick to expand / collapse

What happened?

I am using Gemini in VS Code with WSL.

While working in: /home/jacques/repogit/mmm-tools/FLUX

I asked Gemini to create: tests/gemini_test_repo_parent.txt

Gemini reported success and showed the relative path inside the active project, but the file was actually created in a different repository:

/home/jacques/repogit/data-model-core/mmm/tests/gemini_test_repo_parent.txt

So the displayed path did not match the real write location.

Steps to reproduce:

  1. Open VS Code in WSL.
  2. Work in a project such as /home/jacques/repogit/mmm-tools/FLUX.
  3. Ask Gemini to create a file in tests using a relative path.
  4. Gemini reports success.
  5. Search the filesystem and verify the file may be created in a different repository.

What did you expect to happen?

The file should have been created in the active workspace, at:

/home/jacques/repogit/mmm-tools/FLUX/tests/gemini_test_repo_parent.txt

Gemini should always resolve relative paths against the current workspace/project only. The path displayed in the UI should match the actual file written on disk.

Client information

Using Gemini in VS Code with WSL Ubuntu. This report comes from the VS Code integration, not Gemini CLI. Platform: Windows + WSL Ubuntu.

Login information

google account

Anything else we need to know?

How can we reproduce it?

  1. Open VS Code in WSL.
  2. Open or work inside a project such as: /home/jacques/repogit/mmm-tools/FLUX
  3. Ask Gemini to create a file with a relative path, for example: "Create a test file named gemini_test_repo_parent.txt in the tests folder"
  4. Gemini reports success and shows the relative path under the current project.
  5. Search the filesystem for the created file.

In my case, the file was created in a different repository: /home/jacques/repogit/data-model-core/mmm/tests/gemini_test_repo_parent.txt instead of the active project.

Environment

  • VS Code
  • WSL (Ubuntu)
  • Gemini in VS Code
  • Active working directory: /home/jacques/repogit/mmm-tools/FLUX

Additional context : I ran a comparison test.

When I opened only the FLUX folder directly as the VS Code workspace root, Gemini created the file in the correct location.

When working in the broader parent workspace / repo context, Gemini reported the correct relative path in the UI, but the file was actually written into another project.

This suggests a workspace/path resolution bug, possibly involving stale context, parent repo handling, or wrong workspace resolution in WSL.

extent analysis

TL;DR

The issue can be mitigated by opening the specific project folder as the VS Code workspace root instead of a broader parent workspace.

Guidance

  • Verify that the issue is specific to the WSL environment and Gemini integration in VS Code by testing the same scenario in a native Linux or Windows environment.
  • Try to reproduce the issue with a minimal project setup to isolate the problem and confirm if it's related to the workspace or project structure.
  • Check if the issue persists when using the Gemini CLI instead of the VS Code integration to rule out any VS Code-specific problems.
  • Consider testing with a different relative path or file name to see if the issue is specific to the "tests" folder or the file name used.

Example

No specific code snippet is applicable in this case, as the issue seems to be related to the interaction between Gemini, VS Code, and WSL.

Notes

The issue might be specific to the combination of WSL, VS Code, and Gemini, and further investigation is needed to determine the root cause. The fact that opening the specific project folder as the workspace root resolves the issue suggests a potential problem with workspace resolution or context handling.

Recommendation

Apply workaround: Open the specific project folder as the VS Code workspace root to ensure correct file creation. This approach is recommended because it has been shown to resolve the issue in the provided test case, although it may not address the underlying cause.

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