Skip to content

OpenTUI appears to not be respecting setting TMPDIR when starting up, leading to failure to initialize OpenTUI library #4605

Closed

Description

@apdt

Description

$ TMPDIR=~/tmp2 opencode --print-logs --log-level DEBUG
INFO  2025-11-19T15:49:09 +222ms service=default version=1.0.78 args=["--print-logs","--log-level","DEBUG"] opencode
^[\ERROR 2025-11-19T15:49:10 +375ms service=acp-command promise={} reason=Failed to initialize OpenTUI render library: Failed to open library "/tmp/.d97d732dff7fbff3-00000001.so": /tmp/.d97d732dff7fbff3-00000001.so: failed to map segment from shared object Unhandled rejection
ERROR 2025-11-19T15:49:10 +0ms service=default e=Failed to initialize OpenTUI render library: Failed to open library "/tmp/.d97d732dff7fbff3-00000001.so": /tmp/.d97d732dff7fbff3-00000001.so: failed to map segment from shared object rejection
ERROR 2025-11-19T15:49:10 +0ms service=default Error: Failed to initialize OpenTUI render library: Failed to open library "/tmp/.d97d732dff7fbff3-00000001.so": /tmp/.d97d732dff7fbff3-00000001.so: failed to map segment from shared object

This appears to be related to a longer standing bug that was closed recently #3765.

For me, all versions later than 1.0.55 fail. This also appears to affect Windows and other OS's.

Many secure environments mount /tmp with noexec as a standard security practice to prevent privilege escalation attacks. This is recommended by various security frameworks including CIS benchmarks and NIST guidelines. The application should not assume /tmp will have executable permissions.

OpenCode version

1.0.56+

Steps to reproduce

TMPDIR=~/tmp2 opencode --print-logs --log-level DEBUG

Screenshot and/or share link

No response

Operating System

SUSE linux

Terminal

bash

Activity

  1. added
    bugSomething isn't working
    on Nov 21, 2025
  2. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 21, 2025
  3. kommander commented on Nov 22, 2025

    @kommander
    Contributor

    I am not sure that is an opentui issue, that's the opencode executable? Opentui itself does not execute anything and does not deal with the tmpdir, unless the app tells it to, it uses XDG_CONFIG_HOME and XDG_DATA_HOME to download additional tree-sitter parsers and queries, that's about it. @thdxr @rekram1-node

  4. rwese commented on Nov 28, 2025

    @rwese
    Contributor

    It took me some digging into Bun to find this, but BUN_TMPDIR is what we must define:

    $ BUN_TMPDIR=~/.tmp opencode --print-logs
  5. rwese commented on Nov 28, 2025

    @rwese
    Contributor

    I could add a 'KnownIssues' Pointer to the documentation, if needed let me know i can provide the PR.

  6. kommander commented on Nov 28, 2025

    @kommander
    Contributor

    I think I misread the original issue earlier, that might be a bun issue if it unpacks native libs for ffi bindings into the wrong dir.

  7. camAtGitHub commented on Nov 30, 2025

    @camAtGitHub

    We also have /tmp set to noexec.
    $ BUN_TMPDIR=~/.tmp opencode /my/repo/dir was the secret sauce I needed.

  8. azinsharaf commented on Mar 17, 2026

    @azinsharaf

    It took me some digging into Bun to find this, but BUN_TMPDIR is what we must define:

    $ BUN_TMPDIR=~/.tmp opencode --print-logs

    i can confirm this workaround fixed the issue on Win 10. Is there any fix planned for it?

    mkdir ~/.tmp
    $env:BUN_TMPDIR = "$HOME/.tmp"
    opencode --log-level DEBUG --print-logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions