Skip to content

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

Closed

Description

@geclos

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

Activity

  1. github-actions commented on Sep 26, 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. jflaflamme commented on Sep 26, 2025

    @jflaflamme

    same

  3. sigg3net commented on Sep 26, 2025

    @sigg3net

    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"
    
  4. sigg3net commented on Sep 26, 2025

    @sigg3net

    Seems to be this commit:

    c87a746#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
    
  5. lgladysz commented on Sep 26, 2025

    @lgladysz
    Contributor

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

    The problem is probably with this change:
    70310a3#diff-2ca52542d251bb69bf981f39dd51de9943a6c2cb4ee53d7799c83bbf322a0891R121

    In ALLOWED_DIRS likely "bin" entry is missing:

      async function assertValid(dir: string) {
        const ALLOWED_DIRS = new Set(["agent", "command", "mode", "plugin"])
    
  6. arsham commented on Sep 26, 2025

    @arsham

    The last release fixes it.

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

Metadata

Metadata

Assignees

No one assigned

    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