Skip to content

Cannot open terminal from opencode web #5685

Closed as not planned
Closed as not planned

Description

@dejan-vasic

Description

:~$ opencode web

                                  
  █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█
  █░░█ █░░█ █▀▀▀ █░░█ █░░░ █░░█ █░░█ █▀▀▀
  ▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀     ▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀

  Web interface:      http://127.0.0.1:34305/
Failed to load lib 71 | Set BUN_PTY_LIB or ensure one of these paths contains the file.`);
72 | }
73 | var libPath = resolveLibPath();
74 | var lib;
75 | try {
76 |   lib = dlopen(libPath, {
             ^
error: Failed to open library "/tmp/.1ebbff7e77fcfd7a-00000001.so": /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.39' not found (required by /tmp/.1ebbff7e77fcfd7a-00000001.so)
 syscall: "dlopen",
   errno: 0,
    code: "ERR_DLOPEN_FAILED"

      at dlopen (bun:ffi:345:28)
      at <anonymous> (../../node_modules/.bun/bun-pty@0.4.2/node_modules/bun-pty/dist/index.js:76:9)
      at <anonymous> (/$bunfs/root/src/index.js:28:48)
      at <anonymous> (src/pty/index.ts:36:23)

^C
:~$ ldd --version
ldd (Ubuntu GLIBC 2.35-0ubuntu3.11) 2.35
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

OpenCode version

1.0.164

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

WSL

Terminal

No response

Activity

  1. github-actions commented on Dec 17, 2025

    @github-actions
    Contributor

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

    These issues also report similar GLIBC version compatibility errors on older Linux systems. The root cause appears to be that OpenCode (or its dependencies like bun-pty) is compiled against a newer version of GLIBC than what's available on your system.

    Feel free to ignore if your specific case involves the PTY library loading within the web interface, which may be a distinct issue.

  2. remorses commented on Dec 30, 2025

    @remorses
    Contributor

    This is a GLIBC version mismatch in bun-pty. The library was built on Ubuntu 24.04 (GLIBC 2.39) but the system has an older version.

    Fix PR: sursaone/bun-pty#23

    This switches the build to ubuntu-20.04 (GLIBC 2.31) for broader compatibility.

  3. Material-Scientist commented on Jan 8, 2026

    @Material-Scientist

    Still facing this issue on the latest docker image when trying to toggle the terminal in opencode web:

    INFO  2026-01-08T17:42:36 +137ms service=default version=1.1.6 args=["--port=3000","--hostname=0.0.0.0","--print-logs","--log-level=DEBUG"] opencode
    INFO  2026-01-08T17:42:36 +1ms service=config path=/root/.config/opencode/config.json loading
    INFO  2026-01-08T17:42:36 +1ms service=config path=/root/.config/opencode/opencode.json loading
    INFO  2026-01-08T17:42:36 +12ms service=config path=/root/.config/opencode/opencode.jsonc loading
    ERROR 2026-01-08T17:43:06 +29808ms service=default e=undefined is not an object (evaluating 'array3.length') rejection
    ERROR 2026-01-08T17:43:06 +1ms service=default TypeError: undefined is not an object (evaluating 'array3.length')
    Failed to load lib  99 | // biome-ignore lint/suspicious/noExplicitAny: <explanation>
    100 | let lib: any;
    101 | 
    102 | // try to load the lib, if it fails log the error
    103 | try {
    104 | 	lib = dlopen(libPath, {
                 ^
    error: Failed to open library "/tmp/.fd98d2bfe5febbfc-00000001.so": Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /tmp/.fd98d2bfe5febbfc-00000001.so)
     syscall: "dlopen",
       errno: 0,
        code: "ERR_DLOPEN_FAILED"
    
          at dlopen (bun:ffi:345:28)
          at <anonymous> (../../node_modules/.bun/bun-pty@0.4.4/node_modules/bun-pty/src/terminal.ts:104:8)
          at <anonymous> (/$bunfs/root/src/cli/cmd/tui/worker.js:28:48)
          at <anonymous> (../../node_modules/.bun/bun-pty@0.4.4/node_modules/bun-pty/src/index.ts:6:1)
          at <anonymous> (/$bunfs/root/src/cli/cmd/tui/worker.js:28:48)
          at <anonymous> (src/pty/index.ts:19:23)
    
    

    Nomad job:

    job "opencode" {
      group "opencode" {
        network {
          mode = "bridge"
          port "envoy-metrics" {}
          port "plannotator" {
            static = 9999
            to = 9999
          }
        }
        volume "opencode" {
          type            = "csi"
          read_only       = false
          source          = "opencode"
          access_mode     = "single-node-writer"
          attachment_mode = "file-system"
        }    
        constraint {
          attribute = "${attr.unique.hostname}"
          operator  = "regexp"
          value     = "SMTRL-P05"
        }
        service {
          name     = "opencode"
          port     = "3000"
          meta {
            envoy_metrics_port = "${NOMAD_HOST_PORT_envoy_metrics}" # make envoy metrics port available in Consul
          }
          tags = [
    				"traefik.http.routers.opencode.middlewares=https-headers@file",
          ]
          connect {
            sidecar_service {
              proxy {
                transparent_proxy {
                  exclude_outbound_ports = [53,8600,443]
                  exclude_outbound_cidrs = ["172.26.64.0/20","127.0.0.0/8"]
                }
                expose {
                  path {
                    path = "/metrics"
                    protocol = "http"
                    local_path_port = 9102
                    listener_port = "envoy-metrics"
                  }
                }
              }
            }
          }
          check {
            expose = true
            type     = "http"
            path     = "/global/health"
            interval = "15s"
            timeout  = "1s"
          }
        }
        task "opencode" {
          driver = "docker"
          config {
            image = "ghcr.io/anomalyco/opencode" # latest
            #command = "serve"
            args = [
              "--port=3000",
              "--hostname=0.0.0.0",
              "--print-logs",
              "--log-level=DEBUG"
              #"--mdns=true"
            ]
            volumes = [
              "local/custom-config.json:/root/.config/opencode/opencode.json",
              "local/AGENTS.md:/root/.config/opencode/AGENTS.md",
            ]
          }
          volume_mount {
            volume      = "opencode"
            destination = "/root/.local/share/opencode/storage"
            read_only = false
          }      
          resources {
            cpu = 1024
            memory = 1024
            memory_max = 4096
          }
          template {
            destination = "local/custom-config.json"
            data = <<EOH
    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["@plannotator/opencode@latest"],
    	"mcp": {
        "web-search": {
          "type": "remote",
          "url": "http://n8n.virtual.consul/mcp/8cc2af19-111a-45a5-a282-1548f1ea2892",
          "enabled": true
        }
      },
      "provider": {
        "llama.cpp": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "llama-server (local)",
          "options": {
            "baseURL": "http://local-ai.virtual.consul/v1"
          },
          "models": {
            "gpt-oss-120b-GGUF": {
              "id": "gpt-oss-120b-GGUF",
              "name": "gpt-oss-120b-GGUF",
              "tool_call": true,
              "reasoning": true,
              "limit": {
                "context": 128000,
                "output": 65536
              }
            },
    				"Qwen3-8B-128k-GGUF": {
              "id": "Qwen3-8B-128k-GGUF",
              "name": "Qwen3-8B-128k-GGUF",
              "tool_call": true,
              "reasoning": false,
              "limit": {
                "context": 128000,
                "output": 65536
              }
            },
          }
        }
      },
      "model": "llama-server/gpt-oss-120b-GGUF",
      "agent": {
        "build": {
          "description": "Default coding mode with only Opencode tools.",
          "tools": {
            "read": true,
            "write": true,
            "edit": true,
            "bash": true,
            "grep": true,
            "glob": true,
            "list": true,
            "webfetch": true,
            "patch": true,
            "todoread": true,
            "todowrite": true,
            "submit_plan": true
          },
          "prompt": "{file:./AGENTS.md}"
        }
      },
      "instructions": ["AGENTS.md"]
    }        
    EOH        
          }
          template {
            destination = "local/AGENTS.md"
            data = <<EOH
    # Tooling rules for Opencode
    - Use Opencode tools only: read, write, edit, list, glob, grep, webfetch, bash, task, todowrite, todoread, submit_plan.
    - Do NOT call non-existent tools like Repo_browser.*.
    - Prefer `edit` for modifying existing files; use `read` to inspect before editing.
    - For any search engine use, utilize the web-search MCP server.
    EOH        
          }
          template {
            destination = "secrets/.env"
            env = true
            data = <<EOH
    PLANNOTATOR_PORT=9999
    PLANNOTATOR_REMOTE=1
    #OPENCODE_CONFIG=/path/to/my/custom-config.json
    #HTTPS_PROXY=http://username:{{ key "secrets/firecrawl/proxy.pw" }}@192.168.178.87:3128
    #https_proxy=http://username:{{ key "secrets/firecrawl/proxy.pw" }}@192.168.178.87:3128        
    EOH
          }
        }
      }
    }
  4. remixer-dec commented on Feb 16, 2026

    @remixer-dec

    issue still exists, for desktop app as well

    probably related to opencode official docker image being an alpine image:
    __tls_get_addr: symbol not found
    getauxval: symbol not found
    gnu_get_libc_version: symbol not found

  5. jinghuan-Chen commented on Mar 3, 2026

    @jinghuan-Chen

    We temporarily resolved the problem using the following steps:

    1. Install the glibc compatibility layer: Use sgerrand/alpine-pkg-glibc to import the glibc library files into Alpine.
    2. Force download of the glibc binary: Manually download opencode-linux-x64.tar.gz (the glibc compiled version) from GitHub Releases instead of using the official installation script (which will automatically detect and install the musl version).
    FROM ghcr.io/anomalyco/opencode:1.2.15
    
    USER root
    
    ENV GLIBC_RELEASE_VERSION=2.35-r1
    ENV BUN_VERSION=1.3.9
    
    RUN apk del libc6-compat gcompat || true \
        && apk add --no-cache curl libstdc++ unzip bash \
        && curl -L https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \
        && curl -L https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_RELEASE_VERSION}/glibc-${GLIBC_RELEASE_VERSION}.apk -o glibc.apk \
        && apk add --no-cache --force-overwrite glibc.apk \
        && rm glibc.apk
    
    RUN curl -fsSL https://github.com/anomalyco/opencode/releases/download/v1.2.15/opencode-linux-x64.tar.gz -o opencode.tar.gz \
        && tar -xzf opencode.tar.gz -C /usr/local/bin \
        && rm opencode.tar.gz \
        && chmod +x /usr/local/bin/opencode \
        # Ensure glibc loader is in the standard path
        && mkdir -p /lib64 \
        && ln -sf /usr/glibc-compat/lib/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2
    
    ENV LD_LIBRARY_PATH=/usr/glibc-compat/lib

    Hopefully this method can help others!

  6. mendhak commented on Mar 13, 2026

    @mendhak

    Still seeing this on 1.2.26, this is what I see in browser console (Firefox):

    Failed to create terminal 
    Object { name: "UnknownError", data: {…} }
    ​
    data: Object { message: "TypeError: undefined is not an object (evaluating 'lib.symbols')\n    at new Terminal2 (/$bunfs/root/src/index.js:253583:22)\n    at spawn6 (/$bunfs/root/src/index.js:253698:23)\n    at create (/$bunfs/root/src/index.js:253805:32)\n    at processTicksAndRejections (native:7:39)" }
    ​
    name: "UnknownError"
    ​
    <prototype>: Object { … }
    index-DybCx3KW.js:2423:174225
        new http://localhost:4096/assets/index-DybCx3KW.js:2423
        (Async: promise callback)
        new http://localhost:4096/assets/index-DybCx3KW.js:2423
        new http://localhost:4096/assets/index-DybCx3KW.js:2423
        s http://localhost:4096/assets/index-DybCx3KW.js:2
        lz http://localhost:4096/assets/index-DybCx3KW.js:2
    
  7. removed
    bugSomething isn't working
    webRelates to opencode on web / desktop
    on May 3, 2026
  8. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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