Wrong working directory #2252

Open
opened 2026-02-16 17:34:50 -05:00 by yindo · 2 comments
Owner

Originally created by @somera on GitHub (Oct 23, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

I worked with opencode v0.15.14 ~2h today.

And sometimes the working directory was wrong.

Image

I'm uwing it with qwen3-coder:30b with ollama self hosted. I set this

Environment="OLLAMA_CONTEXT_LENGTH=32768"
Environment="OLLAMA_KV_CACHE_TYPE=q8_0"

Is this opencode or AI problem?

OpenCode version

0.15.14

Steps to reproduce

I can't reprodeuce it. 8 times is ok, 2 times not

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

Git Bash

Originally created by @somera on GitHub (Oct 23, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description I worked with opencode v0.15.14 ~2h today. And sometimes the working directory was wrong. <img width="1678" height="1292" alt="Image" src="https://github.com/user-attachments/assets/d9dcd050-601e-4fd0-a355-94aa0e3e8ea3" /> I'm uwing it with `qwen3-coder:30b` with ollama self hosted. I set this ``` Environment="OLLAMA_CONTEXT_LENGTH=32768" Environment="OLLAMA_KV_CACHE_TYPE=q8_0" ``` Is this opencode or AI problem? ### OpenCode version 0.15.14 ### Steps to reproduce I can't reprodeuce it. 8 times is ok, 2 times not ### Screenshot and/or share link _No response_ ### Operating System Windows 11 ### Terminal Git Bash
yindo added the bug label 2026-02-16 17:34:50 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 23, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #2177: Allow explicitly changing working directory - discusses working directory issues and the need for directory change commands
  • #1143: Create session with a different root/working directory - similar working directory confusion in mono-repo setups
  • #3220: Unable to run opencode from source outside of packages/opencode directory - related to directory path assumptions
  • #3218: Feature request: ability to disable "File X is not in the current working directory" error - discusses working directory restrictions

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 23, 2025): This issue might be a duplicate of existing issues. Please check: - #2177: Allow explicitly changing working directory - discusses working directory issues and the need for directory change commands - #1143: Create session with a different root/working directory - similar working directory confusion in mono-repo setups - #3220: Unable to run opencode from source outside of packages/opencode directory - related to directory path assumptions - #3218: Feature request: ability to disable "File X is not in the current working directory" error - discusses working directory restrictions Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 23, 2025):

@somera this is the llm calling the tool to list root directory, I think we can do some prompt updates but we do tell the llm to use absolute paths and it is "doing that" but maybe we need to make it more clear that "/" is root :

In tool args

path: z.string().describe("The absolute path to the directory to list (must be absolute, not relative)").optional(),

In the tool description:

Lists files and directories in a given path. The path parameter must be absolute; omit it to use the current workspace directory. You can optionally provide an array of glob patterns to ignore with the ignore parameter. You should generally prefer the Glob and Grep tools, if you know which directories to search.

@rekram1-node commented on GitHub (Oct 23, 2025): @somera this is the llm calling the tool to list root directory, I think we can do some prompt updates but we do tell the llm to use absolute paths and it is "doing that" but maybe we need to make it more clear that "/" is root : In tool args ``` path: z.string().describe("The absolute path to the directory to list (must be absolute, not relative)").optional(), ``` In the tool description: > Lists files and directories in a given path. The path parameter must be absolute; omit it to use the current workspace directory. You can optionally provide an array of glob patterns to ignore with the ignore parameter. You should generally prefer the Glob and Grep tools, if you know which directories to search.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2252