Opencode hangs when opened in a directory with .git #3966

Closed
opened 2026-02-16 17:42:07 -05:00 by yindo · 10 comments
Owner

Originally created by @wojons on GitHub (Dec 29, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

I run my opencode instances inside of coder/code-server. If i open opencode in a blank folder no issue but if i git init that folder it will no longer support opencode. It simply hangs. Again only thing changed is if there is a .git folder or not in the project that breaks everything.

OpenCode version

No response

Steps to reproduce

  1. I install the interface in my coolify server
  2. I install opencode using curl
  3. I install the opencode vscode plugin
  4. i create a directory for my work
  5. git init (same issue if i clone the empty repo)
  6. try to open opencode via vs-code plugin or shell and opencode tui never comes up just blank and have to close window because ctrl+c doesnt effect the processes.

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @wojons on GitHub (Dec 29, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description I run my opencode instances inside of coder/code-server. If i open opencode in a blank folder no issue but if i git init that folder it will no longer support opencode. It simply hangs. Again only thing changed is if there is a .git folder or not in the project that breaks everything. ### OpenCode version _No response_ ### Steps to reproduce 1. I install the interface in my coolify server 2. I install opencode using curl 3. I install the opencode vscode plugin 4. i create a directory for my work 5. git init (same issue if i clone the empty repo) 6. try to open opencode via vs-code plugin or shell and opencode tui never comes up just blank and have to close window because ctrl+c doesnt effect the processes. ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the bug label 2026-02-16 17:42:07 -05:00
yindo closed this issue 2026-02-16 17:42:07 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 29, 2025):

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

  • #4682: opencode get stuck when bun add get stuck
  • #2512: Opencode stuck in "generating"
  • #2940: [BUG] OpenCode just hangs randomly after receiving instructions
  • #1418: working getting stuck and double esc not exiting
  • #2380: bug: immediately exits and other processes never exit

These issues share common themes with hanging/freezing behavior and inability to terminate the application with Ctrl+C or Esc. Feel free to ignore if your specific case (hanging when opening in a .git directory) is distinct from these.

@github-actions[bot] commented on GitHub (Dec 29, 2025): This issue might be a duplicate of existing issues. Please check: - #4682: opencode get stuck when `bun add` get stuck - #2512: Opencode stuck in "generating" - #2940: [BUG] OpenCode just hangs randomly after receiving instructions - #1418: working getting stuck and double esc not exiting - #2380: bug: immediately exits and other processes never exit These issues share common themes with hanging/freezing behavior and inability to terminate the application with Ctrl+C or Esc. Feel free to ignore if your specific case (hanging when opening in a .git directory) is distinct from these.
Author
Owner

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

using opencode run, with print logs flags, anyway u can try running that in there so we can see what step hangs?

@rekram1-node commented on GitHub (Dec 29, 2025): using opencode run, with print logs flags, anyway u can try running that in there so we can see what step hangs?
Author
Owner

@wojons commented on GitHub (Dec 29, 2025):

It just gets stuck there.

# opencode --print-logs run "hello world"
INFO  2025-12-29T15:59:18 +354ms service=default version=1.0.207 args=["--print-logs","run","hello world"] opencode
INFO  2025-12-29T15:59:18 +1ms service=default directory=/config/workspace creating instance
INFO  2025-12-29T15:59:18 +0ms service=project directory=/config/workspace fromDirectory
INFO  2025-12-29T15:59:18 +8ms service=default directory=/config/workspace bootstrapping
INFO  2025-12-29T15:59:18 +2ms service=config path=/config/.config/opencode/config.json loading
INFO  2025-12-29T15:59:18 +1ms service=config path=/config/.config/opencode/opencode.json loading
INFO  2025-12-29T15:59:18 +0ms service=config path=/config/.config/opencode/opencode.jsonc loading
INFO  2025-12-29T15:59:18 +2ms service=bun cmd=["/config/.opencode/bin/opencode","add","@opencode-ai/plugin@1.0.207","--exact"] cwd=/config/.config/opencode running
INFO  2025-12-29T15:59:18 +12ms service=bun code=0 stdout=bun add v1.3.5 (1e86cebd)

installed @opencode-ai/plugin@1.0.207

[4.00ms] done
 stderr=Saved lockfile
 done
INFO  2025-12-29T15:59:18 +0ms service=config path=/config/.opencode/opencode.jsonc loading
INFO  2025-12-29T15:59:18 +1ms service=config path=/config/.opencode/opencode.json loading
INFO  2025-12-29T15:59:18 +0ms service=bun cmd=["/config/.opencode/bin/opencode","add","@opencode-ai/plugin@1.0.207","--exact"] cwd=/config/.opencode running
INFO  2025-12-29T15:59:18 +8ms service=bun code=0 stdout=bun add v1.3.5 (1e86cebd)

installed @opencode-ai/plugin@1.0.207

[3.00ms] done
 stderr=Saved lockfile
 done
INFO  2025-12-29T15:59:18 +5ms service=plugin path=opencode-copilot-auth@0.0.9 loading plugin
INFO  2025-12-29T15:59:18 +5ms service=plugin path=opencode-anthropic-auth@0.0.5 loading plugin
INFO  2025-12-29T15:59:18 +17ms service=bus type=* subscribing
INFO  2025-12-29T15:59:18 +0ms service=bus type=session.updated subscribing
INFO  2025-12-29T15:59:18 +0ms service=bus type=message.updated subscribing
INFO  2025-12-29T15:59:18 +0ms service=bus type=message.part.updated subscribing
INFO  2025-12-29T15:59:18 +0ms service=bus type=session.updated subscribing
INFO  2025-12-29T15:59:18 +0ms service=bus type=message.updated subscribing
INFO  2025-12-29T15:59:18 +0ms service=bus type=message.part.updated subscribing
INFO  2025-12-29T15:59:18 +0ms service=bus type=session.diff subscribing
INFO  2025-12-29T15:59:18 +0ms service=format init
INFO  2025-12-29T15:59:18 +0ms service=bus type=file.edited subscribing
INFO  2025-12-29T15:59:18 +0ms service=lsp serverIds=deno, typescript, vue, eslint, oxlint, biome, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, fsharp, sourcekit-lsp, rust, clangd, svelte, astro, jdtls, yaml-ls, lua-ls, php intelephense, dart, ocaml-lsp, bash, terraform, texlab, dockerfile, gleam, clojure-lsp, nixd, tinymist, haskell-language-server enabled LSP servers
INFO  2025-12-29T15:59:18 +1ms service=file.watcher init
INFO  2025-12-29T15:59:18 +1ms service=bus type=command.executed subscribing
INFO  2025-12-29T15:59:18 +1ms service=file.watcher platform=linux backend=inotify watcher backend
INFO  2025-12-29T15:59:18 +20ms service=vcs branch=HEAD initialized
INFO  2025-12-29T15:59:18 +0ms service=bus type=file.watcher.updated subscribing

I am going to run some tests using the same container image on my desktop worked fine for the same test, but launching a new container on my dev server is having the same issue. Will try on another server of the same cluster

@wojons commented on GitHub (Dec 29, 2025): It just gets stuck there. ``` # opencode --print-logs run "hello world" INFO 2025-12-29T15:59:18 +354ms service=default version=1.0.207 args=["--print-logs","run","hello world"] opencode INFO 2025-12-29T15:59:18 +1ms service=default directory=/config/workspace creating instance INFO 2025-12-29T15:59:18 +0ms service=project directory=/config/workspace fromDirectory INFO 2025-12-29T15:59:18 +8ms service=default directory=/config/workspace bootstrapping INFO 2025-12-29T15:59:18 +2ms service=config path=/config/.config/opencode/config.json loading INFO 2025-12-29T15:59:18 +1ms service=config path=/config/.config/opencode/opencode.json loading INFO 2025-12-29T15:59:18 +0ms service=config path=/config/.config/opencode/opencode.jsonc loading INFO 2025-12-29T15:59:18 +2ms service=bun cmd=["/config/.opencode/bin/opencode","add","@opencode-ai/plugin@1.0.207","--exact"] cwd=/config/.config/opencode running INFO 2025-12-29T15:59:18 +12ms service=bun code=0 stdout=bun add v1.3.5 (1e86cebd) installed @opencode-ai/plugin@1.0.207 [4.00ms] done stderr=Saved lockfile done INFO 2025-12-29T15:59:18 +0ms service=config path=/config/.opencode/opencode.jsonc loading INFO 2025-12-29T15:59:18 +1ms service=config path=/config/.opencode/opencode.json loading INFO 2025-12-29T15:59:18 +0ms service=bun cmd=["/config/.opencode/bin/opencode","add","@opencode-ai/plugin@1.0.207","--exact"] cwd=/config/.opencode running INFO 2025-12-29T15:59:18 +8ms service=bun code=0 stdout=bun add v1.3.5 (1e86cebd) installed @opencode-ai/plugin@1.0.207 [3.00ms] done stderr=Saved lockfile done INFO 2025-12-29T15:59:18 +5ms service=plugin path=opencode-copilot-auth@0.0.9 loading plugin INFO 2025-12-29T15:59:18 +5ms service=plugin path=opencode-anthropic-auth@0.0.5 loading plugin INFO 2025-12-29T15:59:18 +17ms service=bus type=* subscribing INFO 2025-12-29T15:59:18 +0ms service=bus type=session.updated subscribing INFO 2025-12-29T15:59:18 +0ms service=bus type=message.updated subscribing INFO 2025-12-29T15:59:18 +0ms service=bus type=message.part.updated subscribing INFO 2025-12-29T15:59:18 +0ms service=bus type=session.updated subscribing INFO 2025-12-29T15:59:18 +0ms service=bus type=message.updated subscribing INFO 2025-12-29T15:59:18 +0ms service=bus type=message.part.updated subscribing INFO 2025-12-29T15:59:18 +0ms service=bus type=session.diff subscribing INFO 2025-12-29T15:59:18 +0ms service=format init INFO 2025-12-29T15:59:18 +0ms service=bus type=file.edited subscribing INFO 2025-12-29T15:59:18 +0ms service=lsp serverIds=deno, typescript, vue, eslint, oxlint, biome, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, fsharp, sourcekit-lsp, rust, clangd, svelte, astro, jdtls, yaml-ls, lua-ls, php intelephense, dart, ocaml-lsp, bash, terraform, texlab, dockerfile, gleam, clojure-lsp, nixd, tinymist, haskell-language-server enabled LSP servers INFO 2025-12-29T15:59:18 +1ms service=file.watcher init INFO 2025-12-29T15:59:18 +1ms service=bus type=command.executed subscribing INFO 2025-12-29T15:59:18 +1ms service=file.watcher platform=linux backend=inotify watcher backend INFO 2025-12-29T15:59:18 +20ms service=vcs branch=HEAD initialized INFO 2025-12-29T15:59:18 +0ms service=bus type=file.watcher.updated subscribing ``` I am going to run some tests using the same container image on my desktop worked fine for the same test, but launching a new container on my dev server is having the same issue. Will try on another server of the same cluster
Author
Owner

@wojons commented on GitHub (Dec 29, 2025):

I dont know what caused it because new containers rebooted contieners all had the same issue but only 1 server had it. i rebooted that server and it is fine we can close or leave this ticket open maybe with a differnet label and see if anyone else comes by with the same type of issue

@wojons commented on GitHub (Dec 29, 2025): I dont know what caused it because new containers rebooted contieners all had the same issue but only 1 server had it. i rebooted that server and it is fine we can close or leave this ticket open maybe with a differnet label and see if anyone else comes by with the same type of issue
Author
Owner

@jumpmanjay commented on GitHub (Dec 29, 2025):

I have this same issue. I am wondering if it is related to inotify running out of watches? I notice that is also hangs at the file.watcher subscription. If I log into another server that has no other of my processes running, it works with git. So likely @wojons had no inotify issues on the freshly rebooted container.

A fix for this issue would be appreciated!

@jumpmanjay commented on GitHub (Dec 29, 2025): I have this same issue. I am wondering if it is related to inotify running out of watches? I notice that is also hangs at the file.watcher subscription. If I log into another server that has no other of my processes running, it works with git. So likely @wojons had no inotify issues on the freshly rebooted container. A fix for this issue would be appreciated!
Author
Owner

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

yeah ill add a timeout to it, can you also do an ls in .git and see if there are any folders i didnt exclude in watcher.ts? ig i should just ls, exclude everything but the 1 file

Im really only trying to watch the current branch and nothing else

@rekram1-node commented on GitHub (Dec 29, 2025): yeah ill add a timeout to it, can you also do an ls in .git and see if there are any folders i didnt exclude in watcher.ts? ig i should just ls, exclude everything but the 1 file Im really only trying to watch the current branch and nothing else
Author
Owner

@jumpmanjay commented on GitHub (Dec 29, 2025):

yeah ill add a timeout to it, can you also do an ls in .git and see if there are any folders i didnt exclude in watcher.ts? ig i should just ls, exclude everything but the 1 file

Im really only trying to watch the current branch and nothing else

It looks like "branches" is missing

@jumpmanjay commented on GitHub (Dec 29, 2025): > yeah ill add a timeout to it, can you also do an ls in .git and see if there are any folders i didnt exclude in watcher.ts? ig i should just ls, exclude everything but the 1 file > > Im really only trying to watch the current branch and nothing else It looks like "branches" is missing
Author
Owner

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

ig ur git version is super old then..

@rekram1-node commented on GitHub (Dec 29, 2025): ig ur git version is super old then..
Author
Owner

@jumpmanjay commented on GitHub (Dec 29, 2025):

ig ur git version is super old then..

Likely. v2.31.3

@jumpmanjay commented on GitHub (Dec 29, 2025): > ig ur git version is super old then.. Likely. v2.31.3
Author
Owner
@rekram1-node commented on GitHub (Dec 29, 2025): pushed 2 fixes, should be fixed in next release https://github.com/sst/opencode/commit/02e5a1924298261234504acb4a6450506dd59034 https://github.com/sst/opencode/commit/76b012139af40c64d8dbd0dc0b1a53242a52df6b
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3966