Can't init my project #1504

Closed
opened 2026-02-16 17:31:17 -05:00 by yindo · 19 comments
Owner

Originally created by @amber-moe on GitHub (Aug 26, 2025).

Originally assigned to: @thdxr on GitHub.

I jump to the path to my project. Then run opencode, then /init. But something went wrong.

ambermoe@U-4512X229-2148 ai-write-code % pwd
/Users/ambermoe/Desktop/ai-write-code
ambermoe@U-4512X229-2148 ai-write-code % opencode
ambermoe@U-4512X229-2148 ai-write-code % /init
zsh: no such file or directory: /init
ambermoe@U-4512X229-2148 ai-write-code % /init
zsh: no such file or directory: /init
ambermoe@U-4512X229-2148 ai-write-code % init
zsh: command not found: init
ambermoe@U-4512X229-2148 ai-write-code % opencode init
Error: Failed to change directory to /Users/ambermoe/Desktop/ai-write-code/init

I'm using Ghossty, Version 1.1.3. Any ideas? macOS Sequoia Version 15.1.1

opencode --version
0.5.28

Claude Anthropic manually enter the key.

Originally created by @amber-moe on GitHub (Aug 26, 2025). Originally assigned to: @thdxr on GitHub. I jump to the path to my project. Then run opencode, then `/init`. But something went wrong. ```text ambermoe@U-4512X229-2148 ai-write-code % pwd /Users/ambermoe/Desktop/ai-write-code ambermoe@U-4512X229-2148 ai-write-code % opencode ambermoe@U-4512X229-2148 ai-write-code % /init zsh: no such file or directory: /init ambermoe@U-4512X229-2148 ai-write-code % /init zsh: no such file or directory: /init ambermoe@U-4512X229-2148 ai-write-code % init zsh: command not found: init ambermoe@U-4512X229-2148 ai-write-code % opencode init Error: Failed to change directory to /Users/ambermoe/Desktop/ai-write-code/init ``` I'm using Ghossty, Version 1.1.3. Any ideas? macOS Sequoia Version 15.1.1 opencode --version 0.5.28 Claude Anthropic manually enter the key.
yindo added the model-problem label 2026-02-16 17:31:17 -05:00
yindo closed this issue 2026-02-16 17:31:17 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Aug 26, 2025):

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

  • #1398: [feature request: expose '/init' , '/compact' to Opencode CLI] - This explains that /init is a TUI command, not a shell command
  • #1285: [/init command does nothing] - Similar issue with /init not working as expected
  • #866: [New Session Using Groq Hosted Deepseek R1 Provides No Response] - Shows /init usage in TUI context
  • #1906: [if CLAUDE.md exists, /init should modify it, not create AGENTS.md] - Demonstrates proper /init usage

The /init command should be used inside the opencode TUI, not as a shell command. Try:

  1. Run opencode to enter the TUI
  2. Type /init in the chat interface (not in your shell)

The error opencode init occurs because opencode is looking for a directory named 'init', which doesn't exist.

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

@github-actions[bot] commented on GitHub (Aug 26, 2025): This issue might be a duplicate of existing issues. Please check: - #1398: [feature request: expose '/init' , '/compact' to Opencode CLI] - This explains that `/init` is a TUI command, not a shell command - #1285: [/init command does nothing] - Similar issue with `/init` not working as expected - #866: [New Session Using Groq Hosted Deepseek R1 Provides No Response] - Shows `/init` usage in TUI context - #1906: [if `CLAUDE.md` exists, `/init` should modify it, not create `AGENTS.md`] - Demonstrates proper `/init` usage The `/init` command should be used **inside the opencode TUI**, not as a shell command. Try: 1. Run `opencode` to enter the TUI 2. Type `/init` in the chat interface (not in your shell) The error `opencode init` occurs because opencode is looking for a directory named 'init', which doesn't exist. Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Aug 26, 2025):

maybe you misunderstand how opencode works, but opencode should launch the tui, then you type /init and hit enter. This is a slash command

@rekram1-node commented on GitHub (Aug 26, 2025): maybe you misunderstand how opencode works, but `opencode` should launch the tui, then you type `/init` and hit enter. This is a slash command
Author
Owner

@johnjelinek commented on GitHub (Sep 2, 2025):

for me, it only outputs a json response without creating an AGENTS.md:

I'll analyze the codebase to create an AGENTS.md file with build/lint/test
commands and code style guidelines. First, let me check for existing
AGENTS.md or relevant configuration files.

[{"name": "read", "arguments": {"filePath": "/AGENTS.md"}}, {"name":
"list", "arguments": {"path": "/", "ignore": ["node_modules/", "target/",
".git/"]}}, {"name": "read", "arguments": {"filePath": "/package.json"}},
{"name": "read", "arguments": {"filePath": "/.cursor/rules"}}, {"name":
"read", "arguments": {"filePath": "/.github/copilot-instructions.md"}}]

< continue

I need to continue working on the task. Let me check the status of our
analysis and see what we've accomplished so far.

Let's start by examining the current state of the codebase, specifically
looking at the relevant files that would need modification for this fix.

List /home/user/project

Error: ENOENT: no such file or directory, open '/home/user/project

but that's not my current working directory ☝️

@johnjelinek commented on GitHub (Sep 2, 2025): for me, it only outputs a json response without creating an AGENTS.md: > I'll analyze the codebase to create an AGENTS.md file with build/lint/test > commands and code style guidelines. First, let me check for existing > AGENTS.md or relevant configuration files. > > [{"name": "read", "arguments": {"filePath": "/AGENTS.md"}}, {"name": > "list", "arguments": {"path": "/", "ignore": ["node_modules/", "target/", > ".git/"]}}, {"name": "read", "arguments": {"filePath": "/package.json"}}, > {"name": "read", "arguments": {"filePath": "/.cursor/rules"}}, {"name": > "read", "arguments": {"filePath": "/.github/copilot-instructions.md"}}] < `continue` > I need to continue working on the task. Let me check the status of our > analysis and see what we've accomplished so far. > > Let's start by examining the current state of the codebase, specifically > looking at the relevant files that would need modification for this fix. > > List /home/user/project > > Error: ENOENT: no such file or directory, open '/home/user/project but that's not my current working directory ☝️
Author
Owner

@rekram1-node commented on GitHub (Sep 2, 2025):

@johnjelinek what model are you using? Can you maybe send a /share link?

@rekram1-node commented on GitHub (Sep 2, 2025): @johnjelinek what model are you using? Can you maybe send a /share link?
Author
Owner

@johnjelinek commented on GitHub (Sep 2, 2025):

This model: hf.co/unsloth/Qwen3-Coder-30B-A3B-Instruct-GGUF:UD-Q4_K_XL -- I think I was able to generate an AGENTS.md by increasing the context, ie: OLLAMA_CONTEXT_LENGTH=12288 ollama serve

@johnjelinek commented on GitHub (Sep 2, 2025): This model: `hf.co/unsloth/Qwen3-Coder-30B-A3B-Instruct-GGUF:UD-Q4_K_XL` -- I think I was able to generate an `AGENTS.md` by increasing the context, ie: `OLLAMA_CONTEXT_LENGTH=12288 ollama serve`
Author
Owner

@rekram1-node commented on GitHub (Sep 2, 2025):

Ahh can you replicate the issue after setting that? I think that was the recommended ollama fix as of this issue: https://github.com/sst/opencode/issues/1068

@rekram1-node commented on GitHub (Sep 2, 2025): Ahh can you replicate the issue after setting that? I think that was the recommended ollama fix as of this issue: https://github.com/sst/opencode/issues/1068
Author
Owner

@rekram1-node commented on GitHub (Sep 2, 2025):

I think this may just be ollama thing

@rekram1-node commented on GitHub (Sep 2, 2025): I think this may just be ollama thing
Author
Owner

@johnjelinek commented on GitHub (Sep 2, 2025):

that comment in #1068 is what inspired me to give it a try. However, it doesn't work with the deepseek-r1 models because the parameter is hardcoded into the model template. So, for those, you gotta:

ollama run deepseek-r1:8b
/set parameter num_ctx 12288
/save deepseek-r1:8b-12k

and then use that model in your config: deepseek-r1:8b-12k

@johnjelinek commented on GitHub (Sep 2, 2025): that comment in #1068 is what inspired me to give it a try. However, it doesn't work with the deepseek-r1 models because the parameter is hardcoded into the model template. So, for those, you gotta: ```shell ollama run deepseek-r1:8b /set parameter num_ctx 12288 /save deepseek-r1:8b-12k ``` and then use that model in your config: `deepseek-r1:8b-12k`
Author
Owner

@johnjelinek commented on GitHub (Sep 2, 2025):

that being said, I'm not sure why that would make this unique to ollama. Wouldn't llama-server have the same issue?

@johnjelinek commented on GitHub (Sep 2, 2025): that being said, I'm not sure why that would make this unique to ollama. Wouldn't llama-server have the same issue?
Author
Owner

@rekram1-node commented on GitHub (Sep 2, 2025):

Possibly, I don't know for certain I just know 99% of the time I see these issues it is someone using ollama, those using LMStudio generally have better success

@rekram1-node commented on GitHub (Sep 2, 2025): Possibly, I don't know for certain I just know 99% of the time I see these issues it is someone using ollama, those using LMStudio generally have better success
Author
Owner

@johnjelinek commented on GitHub (Sep 2, 2025):

have you had success with running locally (not necessarily ollama, you could do llama-server or llama-cpp-python[server]) with ~32GB RAM on a ~17GB sized model and a limited context window (8192)?

@johnjelinek commented on GitHub (Sep 2, 2025): have you had success with running locally (not necessarily `ollama`, you could do `llama-server` or `llama-cpp-python[server]`) with ~32GB RAM on a ~17GB sized model and a limited context window (`8192`)?
Author
Owner

@rekram1-node commented on GitHub (Sep 2, 2025):

haven't tried tbh

@rekram1-node commented on GitHub (Sep 2, 2025): haven't tried tbh
Author
Owner

@nickkadutskyi commented on GitHub (Sep 5, 2025):

I am having a similar problem.
I used cd into a project and then just run opencode. Now I get this error:
Error: Failed to change directory to /Users/nick/Documents/ucms/opencode
Apparently it requires now to provide a path to a project, and if you don't provide it it will use ./opencode as a path (pretty random). So running opencode . fixes the issue.

@nickkadutskyi commented on GitHub (Sep 5, 2025): I am having a similar problem. I used `cd` into a project and then just run `opencode`. Now I get this error: `Error: Failed to change directory to /Users/nick/Documents/ucms/opencode` Apparently it requires now to provide a path to a project, and if you don't provide it it will use `./opencode` as a path (pretty random). So running `opencode .` fixes the issue.
Author
Owner

@rekram1-node commented on GitHub (Sep 5, 2025):

@nickkadutskyi that's definitely unexpected... how did you install opencode?

@rekram1-node commented on GitHub (Sep 5, 2025): @nickkadutskyi that's definitely unexpected... how did you install opencode?
Author
Owner

@nickkadutskyi commented on GitHub (Sep 5, 2025):

@rekram1-node via nixpkgs, but I don't think it matters since it worked well before.

@nickkadutskyi commented on GitHub (Sep 5, 2025): @rekram1-node via nixpkgs, but I don't think it matters since it worked well before.
Author
Owner

@nickkadutskyi commented on GitHub (Sep 5, 2025):

Here is some output:

ucms 󰘬 main↑1 n/d +69-11 󰇂 󱄅 󰻍 (devenv-shell-env) 󰏖
% nix run github:NixOS/nixpkgs/nixpkgs-unstable#opencode -- --version
0.6.3
ucms 󰘬 main↑1 n/d +69-11 󰇂 󱄅 󰻍 (devenv-shell-env) 󰏖
% nix run github:NixOS/nixpkgs/nixos-25.05#opencode -- --version
0.3.112
ucms 󰘬 main↑1 n/d +69-11 󰇂 󱄅 󰻍 (devenv-shell-env) 󰏖  took 30s
% nix run github:NixOS/nixpkgs/nixpkgs-unstable#opencode --
Error: Failed to change directory to /nix/store/4sppwfm02d88gfih4113zblr4jic4jp7-opencode-0.6.3/bin/opencode
ucms 󰘬 main↑1 n/d +69-11 󰇂 󱄅 󰻍 (devenv-shell-env) 󰏖
% nix run github:NixOS/nixpkgs/nixos-25.05#opencode --
ucms 󰘬 main↑1 n/d +69-11 󰇂 󱄅 󰻍 (devenv-shell-env) 󰏖  took 4s
% which opencode
/etc/profiles/per-user/nick/bin/opencode
ucms 󰘬 main↑1 n/d +69-11 󰇂 󱄅 󰻍 (devenv-shell-env) 󰏖
% opencode --version
0.6.3
ucms 󰘬 main↑1 n/d +69-11 󰇂 󱄅 󰻍 (devenv-shell-env) 󰏖
% opencode
Error: Failed to change directory to /Users/nick/Documents/ucms/opencode

(In this case /etc/profiles/per-user/nick/bin/opencode is /nix/store/4sppwfm02d88gfih4113zblr4jic4jp7-opencode-0.6.3/bin/opencode )
Only 0.3.112 worked right, but I think all 0.4.* and 0.5.* versions worked.

@nickkadutskyi commented on GitHub (Sep 5, 2025): Here is some output: ```sh ucms 󰘬 main↑1 n/d +69-11 󰇂 󱄅 󰻍 (devenv-shell-env) 󰏖 % nix run github:NixOS/nixpkgs/nixpkgs-unstable#opencode -- --version 0.6.3 ucms 󰘬 main↑1 n/d +69-11 󰇂 󱄅 󰻍 (devenv-shell-env) 󰏖 % nix run github:NixOS/nixpkgs/nixos-25.05#opencode -- --version 0.3.112 ucms 󰘬 main↑1 n/d +69-11 󰇂 󱄅 󰻍 (devenv-shell-env) 󰏖 took 30s % nix run github:NixOS/nixpkgs/nixpkgs-unstable#opencode -- Error: Failed to change directory to /nix/store/4sppwfm02d88gfih4113zblr4jic4jp7-opencode-0.6.3/bin/opencode ucms 󰘬 main↑1 n/d +69-11 󰇂 󱄅 󰻍 (devenv-shell-env) 󰏖 % nix run github:NixOS/nixpkgs/nixos-25.05#opencode -- ucms 󰘬 main↑1 n/d +69-11 󰇂 󱄅 󰻍 (devenv-shell-env) 󰏖 took 4s % which opencode /etc/profiles/per-user/nick/bin/opencode ucms 󰘬 main↑1 n/d +69-11 󰇂 󱄅 󰻍 (devenv-shell-env) 󰏖 % opencode --version 0.6.3 ucms 󰘬 main↑1 n/d +69-11 󰇂 󱄅 󰻍 (devenv-shell-env) 󰏖 % opencode Error: Failed to change directory to /Users/nick/Documents/ucms/opencode ``` (In this case /etc/profiles/per-user/nick/bin/opencode is /nix/store/4sppwfm02d88gfih4113zblr4jic4jp7-opencode-0.6.3/bin/opencode ) Only `0.3.112` worked right, but I think all `0.4.*` and `0.5.*` versions worked.
Author
Owner

@rekram1-node commented on GitHub (Sep 5, 2025):

@nickkadutskyi that makes sense, I only see people having issue when they install from nix

@rekram1-node commented on GitHub (Sep 5, 2025): @nickkadutskyi that makes sense, I only see people having issue when they install from nix
Author
Owner

@nickkadutskyi commented on GitHub (Sep 5, 2025):

@rekram1-node actually just checked it if install via via npm and it works properly, both 0.6.3 and 0.6.4

@nickkadutskyi commented on GitHub (Sep 5, 2025): @rekram1-node actually just checked it if install via via npm and it works properly, both 0.6.3 and 0.6.4
Author
Owner

@rekram1-node commented on GitHub (Dec 27, 2025):

[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

@rekram1-node commented on GitHub (Dec 27, 2025): [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1504