Unexpected directory "bin" found in ~/.opencode #1834

Closed
opened 2026-02-16 17:32:51 -05:00 by yindo · 6 comments
Owner

Originally created by @geclos on GitHub (Sep 26, 2025).

Can't start opencode, get this error, did something change recently? Yesterday was working fine. Installed using curl command in mac os.

Originally created by @geclos on GitHub (Sep 26, 2025). Can't start opencode, get this error, did something change recently? Yesterday was working fine. Installed using curl command in mac os.
yindo closed this issue 2026-02-16 17:32:51 -05:00
Author
Owner

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

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

  • #2643: Latest 0.9.9 opencode bin shows bun command - user reports opencode bin showing bun instead of opencode functionality
  • #2766: Opencode just hangs - user reports opencode hanging during startup, specifically during bun package installation step
  • #2765: I removed bundle.pem from user folder and now opencode is not running - user reports startup issues after modifying files in ~/.opencode directory

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

@github-actions[bot] commented on GitHub (Sep 26, 2025): This issue might be a duplicate of existing issues. Please check: - #2643: Latest 0.9.9 opencode bin shows bun command - user reports opencode bin showing bun instead of opencode functionality - #2766: Opencode just hangs - user reports opencode hanging during startup, specifically during bun package installation step - #2765: I removed bundle.pem from user folder and now opencode is not running - user reports startup issues after modifying files in ~/.opencode directory Feel free to ignore if none of these address your specific case.
Author
Owner

@jflaflamme commented on GitHub (Sep 26, 2025):

same

@jflaflamme commented on GitHub (Sep 26, 2025): same
Author
Owner

@sigg3net commented on GitHub (Sep 26, 2025):

Seems like the install script ignores the variables mentioned in the README:

README:

XDG_BIN_DIR=$HOME/.local/bin curl -fsSL https://opencode.ai/install | bash

vs. install script:

INSTALL_DIR=$HOME/.opencode/bin
mkdir -p "$INSTALL_DIR"
@sigg3net commented on GitHub (Sep 26, 2025): Seems like the install script ignores the variables mentioned in the README: README: ``` XDG_BIN_DIR=$HOME/.local/bin curl -fsSL https://opencode.ai/install | bash ``` vs. install script: ``` INSTALL_DIR=$HOME/.opencode/bin mkdir -p "$INSTALL_DIR" ```
Author
Owner

@sigg3net commented on GitHub (Sep 26, 2025):

Seems to be this commit:

https://github.com/sst/opencode/commit/c87a7469a006b789e7235e03f453bdd52464d9b4#diff-1e142e6277b12b7e1110478a24caee8f006a9349e86970c890203d6266209463L44-R46

# Determine installation directory with priority order
if [ -n "${OPENCODE_INSTALL_DIR:-}" ]; then
    INSTALL_DIR="$OPENCODE_INSTALL_DIR"
elif [ -n "${XDG_BIN_DIR:-}" ]; then
    INSTALL_DIR="$XDG_BIN_DIR"
elif [ -d "$HOME/bin" ] || mkdir -p "$HOME/bin" 2>/dev/null; then
    INSTALL_DIR="$HOME/bin"

Was changed to:

INSTALL_DIR=$HOME/.opencode/bin
mkdir -p "$INSTALL_DIR"

Workaround, download the script locally:

$ curl -o opencode_install.sh -fsSL https://opencode.ai/install

then change opencode_install.sh lines

INSTALL_DIR=$HOME/.opencode/bin
mkdir -p "$INSTALL_DIR"

to

# Determine installation directory with priority order
if [ -n "${OPENCODE_INSTALL_DIR:-}" ]; then
    INSTALL_DIR="$OPENCODE_INSTALL_DIR"
elif [ -n "${XDG_BIN_DIR:-}" ]; then
    INSTALL_DIR="$XDG_BIN_DIR"
elif [ -d "$HOME/bin" ] || mkdir -p "$HOME/bin" 2>/dev/null; then
    INSTALL_DIR="$HOME/bin"
else
    INSTALL_DIR=$HOME/.opencode/bin
fi
mkdir -p "$INSTALL_DIR"

then execute e.g.

$ chmod +x opencode_install.sh
$ OPENCODE_INSATLL_DIR="$HOME/.local/bin" ./opencode_install.sh
@sigg3net commented on GitHub (Sep 26, 2025): Seems to be this commit: https://github.com/sst/opencode/commit/c87a7469a006b789e7235e03f453bdd52464d9b4#diff-1e142e6277b12b7e1110478a24caee8f006a9349e86970c890203d6266209463L44-R46 ``` # Determine installation directory with priority order if [ -n "${OPENCODE_INSTALL_DIR:-}" ]; then INSTALL_DIR="$OPENCODE_INSTALL_DIR" elif [ -n "${XDG_BIN_DIR:-}" ]; then INSTALL_DIR="$XDG_BIN_DIR" elif [ -d "$HOME/bin" ] || mkdir -p "$HOME/bin" 2>/dev/null; then INSTALL_DIR="$HOME/bin" ``` Was changed to: ``` INSTALL_DIR=$HOME/.opencode/bin mkdir -p "$INSTALL_DIR" ``` Workaround, download the script locally: ``` $ curl -o opencode_install.sh -fsSL https://opencode.ai/install ``` then change `opencode_install.sh` lines ``` INSTALL_DIR=$HOME/.opencode/bin mkdir -p "$INSTALL_DIR" ``` to ``` # Determine installation directory with priority order if [ -n "${OPENCODE_INSTALL_DIR:-}" ]; then INSTALL_DIR="$OPENCODE_INSTALL_DIR" elif [ -n "${XDG_BIN_DIR:-}" ]; then INSTALL_DIR="$XDG_BIN_DIR" elif [ -d "$HOME/bin" ] || mkdir -p "$HOME/bin" 2>/dev/null; then INSTALL_DIR="$HOME/bin" else INSTALL_DIR=$HOME/.opencode/bin fi mkdir -p "$INSTALL_DIR" ``` then execute e.g. ``` $ chmod +x opencode_install.sh $ OPENCODE_INSATLL_DIR="$HOME/.local/bin" ./opencode_install.sh ```
Author
Owner

@lgladysz commented on GitHub (Sep 26, 2025):

@sigg3net You are describing a different issue, which has been with us some time already.

The problem is probably with this change:
https://github.com/sst/opencode/commit/70310a37b323f1c55a73ed3391dd956f1e0ae0ce#diff-2ca52542d251bb69bf981f39dd51de9943a6c2cb4ee53d7799c83bbf322a0891R121

In ALLOWED_DIRS likely "bin" entry is missing:

  async function assertValid(dir: string) {
    const ALLOWED_DIRS = new Set(["agent", "command", "mode", "plugin"])
@lgladysz commented on GitHub (Sep 26, 2025): @sigg3net You are describing a different issue, which has been with us some time already. The problem is probably with this change: https://github.com/sst/opencode/commit/70310a37b323f1c55a73ed3391dd956f1e0ae0ce#diff-2ca52542d251bb69bf981f39dd51de9943a6c2cb4ee53d7799c83bbf322a0891R121 In `ALLOWED_DIRS` likely `"bin"` entry is missing: ``` async function assertValid(dir: string) { const ALLOWED_DIRS = new Set(["agent", "command", "mode", "plugin"]) ```
Author
Owner

@arsham commented on GitHub (Sep 26, 2025):

The last release fixes it.

@arsham commented on GitHub (Sep 26, 2025): The last release fixes it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1834