Skip to content

Not work in a git project, but normal work in a not git dir #2365

Closed

Description

@EachenL

open opencode at a ~ directory everything come normal, but open at a project directory (has a .git folder), custom url port has been changed to a random port

Activity

  1. github-actions commented on Sep 2, 2025

    @github-actions
    Contributor

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

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

  2. rekram1-node commented on Sep 2, 2025

    @rekram1-node
    Collaborator

    Hm can you reword? Not sure I am following

  3. EachenL commented on Sep 2, 2025

    @EachenL
    Author

    Hm can you reword? Not sure I am following

    I'm using a custom providers, And all settings are set according to the settings in the document. My custom endpoint is http://127.0.0.1:52147/api/v1, But when I open opencode in a path with .git, If I want to send content, opencode will report an error:tui failed to send message: POST "http://127.0.0.1:42811/session/ses_67ad6fa15s6eaea516f1/message" : 400 Bad Request.
    However, if I open opencode in a dirctory without .git, It will not report this error and I can send content normally

    opencode version is 0.5.29

  4. reopened this on Sep 2, 2025
  5. changed the title [-]Not work in a project, but normal work in a not git dir[/-] [+]Not work in a git project, but normal work in a not git dir[/+] on Sep 2, 2025
  6. rekram1-node commented on Sep 2, 2025

    @rekram1-node
    Collaborator

    ahh okay

  7. rekram1-node commented on Sep 2, 2025

    @rekram1-node
    Collaborator

    can you run in the directory causing issues:

    opencode run "hello" --print-logs --model <providerId>/<model>
    

    --model /

    ^ For that please replace:

    • with the name of your custom provider
    • with the name of a model that the provider has

    and show me the output

  8. vkmenon commented on Sep 2, 2025

    @vkmenon

    Have the same issue - basically prevents me from using OpenCode at all. My project is a monorepo of decent size (uv / python project).

    I run >>> opencode and then I am able to type into the prompt/text area, but basically the rest of the TUI is unresponsive (i.e. when i type /models nothing shows up).

    In my home directory, opencode is perfectly responsive.

    edit: I am also using a custom provider.

    INFO  2025-09-02T22:03:46 +92ms service=default version=0.6.3 args=["run","hello","--print-logs","--model","LiteLLM/openai/gpt-5"] opencode
    INFO  2025-09-02T22:03:46 +0ms service=project directory=/home fromDirectory
    INFO  2025-09-02T22:03:46 +9ms service=config path=/home/.config/opencode/config.json loading
    INFO  2025-09-02T22:03:46 +1ms service=config path=/home/.config/opencode/opencode.json loading
    INFO  2025-09-02T22:03:46 +3ms service=config path=/home/.config/opencode/opencode.jsonc loading
    INFO  2025-09-02T22:03:46 +2ms service=plugin [email protected] loading plugin
    INFO  2025-09-02T22:03:46 +1ms service=plugin [email protected] loading plugin
    INFO  2025-09-02T22:03:46 +14ms service=bus type=* subscribing
    INFO  2025-09-02T22:03:46 +0ms service=bus type=session.updated subscribing
    INFO  2025-09-02T22:03:46 +0ms service=bus type=message.updated subscribing
    INFO  2025-09-02T22:03:46 +0ms service=bus type=message.part.updated subscribing
    INFO  2025-09-02T22:03:46 +0ms service=format init
    INFO  2025-09-02T22:03:46 +0ms service=bus type=file.edited subscribing
    INFO  2025-09-02T22:03:46 +1ms service=session id=ses_6f38adfa6ffet9fHNHK4bCABLb version=0.6.3 projectID=global directory=/home title=New session - 2025-09-02T22:03:46.649Z time={"created":1756850626649,"updated":1756850626649} created
    INFO  2025-09-02T22:03:46 +0ms service=lsp serverIds=typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd enabled LSP servers
    INFO  2025-09-02T22:03:46 +0ms service=bus type=session.updated publishing
    INFO  2025-09-02T22:03:46 +2ms service=bus type=message.part.updated subscribing
    INFO  2025-09-02T22:03:46 +0ms service=bus type=session.error subscribing
    INFO  2025-09-02T22:03:46 +1ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb chatting
    INFO  2025-09-02T22:03:46 +3ms service=bus type=message.updated publishing
    INFO  2025-09-02T22:03:46 +1ms service=bus type=message.part.updated publishing
    INFO  2025-09-02T22:03:46 +0ms service=bus type=session.updated publishing
    INFO  2025-09-02T22:03:46 +3ms service=models.dev file={} refreshing
    INFO  2025-09-02T22:03:46 +1ms service=provider init
    INFO  2025-09-02T22:03:46 +1ms service=provider providerID=openai found
    INFO  2025-09-02T22:03:46 +0ms service=provider providerID=opencode found
    INFO  2025-09-02T22:03:46 +0ms service=provider providerID=LiteLLM found
    INFO  2025-09-02T22:03:46 +0ms service=provider providerID=LiteLLM modelID=openai/gpt-5 getModel
    INFO  2025-09-02T22:03:46 +1ms service=provider status=started providerID=LiteLLM getSDK
    INFO  2025-09-02T22:03:46 +66ms service=provider status=completed duration=66 providerID=LiteLLM getSDK
    INFO  2025-09-02T22:03:46 +0ms service=provider providerID=LiteLLM modelID=openai/gpt-5 found
    INFO  2025-09-02T22:03:46 +1ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb sessionID=ses_6f38adfa6ffet9fHNHK4bCABLb locking
    INFO  2025-09-02T22:03:46 +13ms service=bus type=message.updated publishing
    INFO  2025-09-02T22:03:46 +1ms service=mcp key=serena type=local found
    INFO  2025-09-02T22:03:47 +1010ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=start part
    INFO  2025-09-02T22:03:48 +1096ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=start-step part
    INFO  2025-09-02T22:03:48 +0ms service=bus type=message.part.updated publishing
    INFO  2025-09-02T22:03:50 +1273ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=reasoning-start part
    INFO  2025-09-02T22:03:51 +1065ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=reasoning-end part
    INFO  2025-09-02T22:03:51 +0ms service=bus type=message.part.updated publishing
    INFO  2025-09-02T22:03:51 +0ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=text-start part
    INFO  2025-09-02T22:03:51 +1ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=text-delta part
    INFO  2025-09-02T22:03:51 +0ms service=bus type=message.part.updated publishing
    INFO  2025-09-02T22:03:51 +7ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=text-delta part
    INFO  2025-09-02T22:03:51 +1ms service=bus type=message.part.updated publishing
    INFO  2025-09-02T22:03:51 +7ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=text-delta part
    INFO  2025-09-02T22:03:51 +0ms service=bus type=message.part.updated publishing
    INFO  2025-09-02T22:03:51 +9ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=text-delta part
    INFO  2025-09-02T22:03:51 +0ms service=bus type=message.part.updated publishing
    INFO  2025-09-02T22:03:51 +12ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=text-delta part
    INFO  2025-09-02T22:03:51 +0ms service=bus type=message.part.updated publishing
    INFO  2025-09-02T22:03:51 +18ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=text-delta part
    INFO  2025-09-02T22:03:51 +0ms service=bus type=message.part.updated publishing
    INFO  2025-09-02T22:03:51 +8ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=text-delta part
    INFO  2025-09-02T22:03:51 +0ms service=bus type=message.part.updated publishing
    INFO  2025-09-02T22:03:51 +13ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=text-delta part
    INFO  2025-09-02T22:03:51 +0ms service=bus type=message.part.updated publishing
    INFO  2025-09-02T22:03:51 +16ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=text-delta part
    INFO  2025-09-02T22:03:51 +1ms service=bus type=message.part.updated publishing
    INFO  2025-09-02T22:03:51 +215ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=text-end part
    INFO  2025-09-02T22:03:51 +0ms service=bus type=message.part.updated publishing
    
    Hi! How can I help you today?
    
    INFO  2025-09-02T22:03:51 +283ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=finish-step part
    INFO  2025-09-02T22:03:51 +1ms service=bus type=message.part.updated publishing
    INFO  2025-09-02T22:03:51 +1ms service=bus type=message.updated publishing
    INFO  2025-09-02T22:03:51 +0ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb type=finish part
    INFO  2025-09-02T22:03:51 +0ms service=bus type=message.updated publishing
    INFO  2025-09-02T22:03:51 +1ms service=bus type=message.updated publishing
    INFO  2025-09-02T22:03:51 +0ms service=session session=ses_6f38adfa6ffet9fHNHK4bCABLb sessionID=ses_6f38adfa6ffet9fHNHK4bCABLb unlocking
    INFO  2025-09-02T22:03:51 +2ms service=bus type=session.idle publishing
    
  9. rekram1-node commented on Sep 2, 2025

    @rekram1-node
    Collaborator

    @vkmenon is that the same issue? OP was having tui failed to send message error toasts? Do you see these too?

  10. arsham commented on Sep 2, 2025

    @arsham

    Does git fsck show you anything?

  11. vkmenon commented on Sep 2, 2025

    @vkmenon

    @arsham
    yes git fsck shows me a lot (it's a big repo and takes a while to run)

    <>$ git fsck
    Checking object directories: 100% (256/256), done.
    Checking objects: 100% (37152/37152), done.
    dangling tree 6400f2fd458871c96d76400dcdaf9b70843068e2
    dangling tree 6700ba5db38824da44e8afb88c4f42c59e22cb22
    dangling commit f100725b4ddea20dfae39e3003f83e85c4194024
    ....
    

    @rekram1-node - apologies, I mostly was piggybacking on the fact that Opencode seems to work in home directory / non-git folder but not in my repo.

  12. arsham commented on Sep 3, 2025

    @arsham

    You have a lot of dangling objects, try this: git gc --prune=now. See if that helps opencode work.

    I would copy the whole project into another directory and test on the copy.

  13. vkmenon commented on Sep 3, 2025

    @vkmenon

    @arsham - still same issue after git gc --prune=now

    however, cloning the repo into another folder seemed to work fine.

    any thoughts as to how opencode is affected by the repo?

  14. 2 remaining items

  15. rekram1-node commented on Sep 3, 2025

    @rekram1-node
    Collaborator

    We have snapshots and that could be causing issue, can you try setting "snapshot": false in your project opencode.json configuration?

  16. rekram1-node commented on Sep 3, 2025

    @rekram1-node
    Collaborator

    You could also try doing:

    rm -rf ~/.local/share/opencode/project/<project-name>/snapshots/
    
  17. AlexandreNeKeR commented on Sep 17, 2025

    @AlexandreNeKeR

    Hi,
    Same issue here. I'm on Windows 11 with opencode 0.9.9. Work perfectly on dir without .git but '400 Bad Request' with a .git.
    Try

    "snapshot": false

    then git gc --prune=now

  18. rekram1-node commented on Sep 17, 2025

    @rekram1-node
    Collaborator

    Does it 400 bad request no matter what in git dir? even if it is a hello?

  19. natinho68 commented on Sep 18, 2025

    @natinho68

    Same problem here, it returns 400 Bad request with a wrong baseUrl and a random port when I use opencode in a project with a .git folder.
    Works well without .git

  20. rekram1-node commented on Sep 18, 2025

    @rekram1-node
    Collaborator

    wrong baseUrl and a random port

    This is the error from the tui sending it to the server, opencode has a client server architecture, when you run opencode it is actually 2 processes: a server and the tui so the tui sends http request to that server

    Can you share what the error is? Maybe if you can run:

    opencode run "hello" --print-logs
    

    in the project with the issue?

  21. AlexandreNeKeR commented on Sep 19, 2025

    @AlexandreNeKeR

    I create a new project with just a uc init. Work well. Commit one time and get the "bad request".

    I add some information: i'm working with restricted internet access. Cause i see : Unable to connect. Is the computer able to access the url? Failed to fetch models.dev.

    INFO  2025-09-19T09:28:49 +140ms service=default version=0.9.9 args=["run","hello","--print-logs"] opencode
    INFO  2025-09-19T09:28:49 +1ms service=project directory=C:\Users\test\MyApp\workspace_atom\test fromDirectory
    INFO  2025-09-19T09:28:49 +98ms service=config path=C:\Users\test\.config\opencode\config.json loading
    INFO  2025-09-19T09:28:49 +0ms service=config path=C:\Users\test\.config\opencode\opencode.json loading
    INFO  2025-09-19T09:28:49 +7ms service=config path=C:\Users\test\.config\opencode\opencode.jsonc loading
    INFO  2025-09-19T09:28:49 +10ms service=plugin [email protected] loading plugin
    INFO  2025-09-19T09:28:49 +4ms service=plugin [email protected] loading plugin
    INFO  2025-09-19T09:28:49 +54ms service=bus type=* subscribing
    INFO  2025-09-19T09:28:49 +0ms service=bus type=session.updated subscribing
    INFO  2025-09-19T09:28:49 +0ms service=bus type=message.updated subscribing
    INFO  2025-09-19T09:28:49 +0ms service=bus type=message.part.updated subscribing
    INFO  2025-09-19T09:28:49 +0ms service=format init
    INFO  2025-09-19T09:28:49 +0ms service=bus type=file.edited subscribing
    INFO  2025-09-19T09:28:49 +2ms service=session id=ses_69eb1f13affeEzVeh3ch7NTLDS version=0.9.9 projectID=746c96e57beae72643c8b0eb8dccea82908df34c directory=C:\Users\test\MyApp\workspace_atom\test title=New session - 2025-09-19T09:28:49.605Z time={"created":1758274129605,"updated":1758274129605} created
    INFO  2025-09-19T09:28:49 +0ms service=lsp serverIds=typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd, svelte enabled LSP servers
    INFO  2025-09-19T09:28:49 +6ms service=bus type=session.updated publishing
    INFO  2025-09-19T09:28:49 +3ms service=bus type=message.part.updated subscribing
    INFO  2025-09-19T09:28:49 +0ms service=bus type=session.error subscribing
    INFO  2025-09-19T09:28:49 +1ms service=session.prompt session=ses_69eb1f13affeEzVeh3ch7NTLDS prompt
    INFO  2025-09-19T09:28:49 +4ms service=bus type=message.updated publishing
    INFO  2025-09-19T09:28:49 +2ms service=bus type=message.part.updated publishing
    INFO  2025-09-19T09:28:49 +2ms service=bus type=session.updated publishing
    INFO  2025-09-19T09:28:49 +3ms service=models.dev file={} refreshing
    INFO  2025-09-19T09:28:49 +2ms service=provider init
    INFO  2025-09-19T09:28:49 +1ms service=provider providerID=openai found
    INFO  2025-09-19T09:28:49 +0ms service=provider providerID=opencode found
    INFO  2025-09-19T09:28:49 +0ms service=provider providerID=test-small found
    INFO  2025-09-19T09:28:49 +0ms service=provider providerID=test-large found
    INFO  2025-09-19T09:28:49 +0ms service=provider providerID=test-codestral found
    INFO  2025-09-19T09:28:49 +0ms service=provider providerID=test-small modelID=mistral-small-2503 getModel
    INFO  2025-09-19T09:28:49 +1ms service=provider status=started providerID=test-small getSDK
    INFO  2025-09-19T09:28:49 +113ms service=provider status=completed duration=113 providerID=test-small getSDK
    INFO  2025-09-19T09:28:49 +1ms service=provider providerID=test-small modelID=mistral-small-2503 found
    INFO  2025-09-19T09:28:49 +1ms service=session.prompt session=ses_69eb1f13affeEzVeh3ch7NTLDS sessionID=ses_69eb1f13affeEzVeh3ch7NTLDS locking
    ERROR 2025-09-19T09:28:49 +5ms service=models.dev error=Unable to connect. Is the computer able to access the url? Failed to fetch models.dev
    INFO  2025-09-19T09:28:49 +24ms service=session.prompt session=ses_69eb1f13affeEzVeh3ch7NTLDS sessionID=ses_69eb1f13affeEzVeh3ch7NTLDS unlocking
    ERROR 2025-09-19T09:28:49 +5ms service=default name=Error message=Unable to connect. Is the computer able to access the url? fatal
    Error: Unexpected error, check log file at  for more details
    INFO  2025-09-19T09:28:49 +12ms service=bus type=session.idle publishing
    
  22. rekram1-node commented on Sep 19, 2025

    @rekram1-node
    Collaborator
  23. AlexandreNeKeR commented on Sep 19, 2025

    @AlexandreNeKeR

    Only with my browser. I'm not an admin on my PC. There are admin restrictions and a proxy.

  24. rekram1-node commented on Sep 19, 2025

    @rekram1-node
    Collaborator

    @AlexandreNeKeR if you run:

    opencode debug paths
    

    find the cache dir, for me it outputs:

    cache      /Users/aidencline/.cache/opencode
    

    And then create a file in that dir^ models.json and place the contents of this in it: https://models.dev/api.json

  25. AlexandreNeKeR commented on Sep 19, 2025

    @AlexandreNeKeR

    I create models.json but same error and same logs.

  26. rekram1-node commented on Sep 19, 2025

    @rekram1-node
    Collaborator

    And models.json has that json content in it?

    and where is it located?

    Did you restart opencode after doing this?

  27. AlexandreNeKeR commented on Sep 22, 2025

    @AlexandreNeKeR
    • Yes
    • ~/.cache/opencode
    • yes i restart opencode
  28. rekram1-node commented on Dec 28, 2025

    @rekram1-node
    Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions