opencode
opencode copied to clipboard
Failed to initialize OpenTUI render library: Failed to open library.
Description
I just installed opencode and failed to start it for first time
❯ opencode
9971 | onAnyNativeEvent(handler) {
9972 | this._anyEventHandlers.push(handler);
9973 | }
9974 | }
9975 | var opentuiLibPath;
9976 | var opentuiLib;
^
error: Failed to initialize OpenTUI render library: Failed to open library. This is usually caused by a missing library or an invalid library path.
at resolveRenderLib (../../node_modules/.bun/@[email protected]+81ecd8642a1892ca/node_modules/@opentui/core/index-3f9h747j.js:9976:5)
at createCliRenderer (../../node_modules/.bun/@[email protected]+81ecd8642a1892ca/node_modules/@opentui/core/index-3f9h747j.js:12441:3)
at createCliRenderer (../../node_modules/.bun/@[email protected]+81ecd8642a1892ca/node_modules/@opentui/core/index-3f9h747j.js:12432:28)
at <anonymous> (../../node_modules/.bun/@[email protected]+1753ef9b65046169/node_modules/@opentui/solid/index.js:893:1)
at render (../../node_modules/.bun/@[email protected]+1753ef9b65046169/node_modules/@opentui/solid/index.js:892:7)
at <anonymous> (src/cli/cmd/tui/app.tsx:95:7)
Whether I install is using brew, bun, npm .. I get same result.
OpenCode version
1.0.11
Steps to reproduce
> bun add -g opencode-ai
> opencode
Screenshot and/or share link
No response
Operating System
macOS 15.7.1 (24G231)
Terminal
fishshell
This issue might be a duplicate of existing issues. Please check:
- #462: Add support for NixOS and/or Static linked binaries - This addresses the fundamental issue of missing system libraries that OpenTUI depends on
- #3540: make opencode work w/ NixOS - Similar library initialization failures on NixOS systems
- #649: running opencode fails in alpine / musl based distros - Same type of library linking issues on musl-based systems
The "Failed to initialize OpenTUI render library" error suggests missing system-level dependencies, which is exactly what these issues track. Your specific platform details (OS, distribution, installation method) would help determine if this is the same underlying problem.
Feel free to ignore if none of these address your specific case.
+1, I also get this error after upgrade.
what cpu do you have
what cpu do you have
I am using opencode on a home server with old i5 cpu:
CPU: Intel i5-9400F (6) @ 4.100GHz OS: Ubuntu 24.04.3 LTS x86_64
PS:
- I tried all v1.0.0+ versions, with different ways to install (curl/zip/bun/brew), the same
Failed to initialize OpenTUI render libraryerror happened. - I also tried to install opentui with bun separately, still no help.
- I have tried to remove old vesion completely and re-install, no help either.
I have downgraded to v0.15.31 (the last version before v1.0.0) and get it working for now.
Same error but thrown in a different place:
10033 | function resolveRenderLib() {
10034 | if (!opentuiLib) {
10035 | try {
10036 | opentuiLib = new FFIRenderLib(opentuiLibPath);
10037 | } catch (error) {
10038 | throw new Error(`Failed to initialize OpenTUI render library: ${error instanceof Error ? error.message : "Unknown error"}`);
^
error: Failed to initialize OpenTUI render library: Failed to open library "/$bunfs/root/libopentui-24nfw5wz.dylib": dlopen(/$bunfs/root/libopentui-24nfw5wz.dylib, 0x0001): tried: '/$bunfs/root/libopentui-24nfw5wz.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/$bunfs/root/libopentui-24nfw5wz.dylib' (no such file), '/$bunfs/root/libopentui-24nfw5wz.dylib' (no such file)
at resolveRenderLib (../../node_modules/.bun/@[email protected]+81ecd8642a1892ca/node_modules/@opentui/core/index-xqg0a6ka.js:10038:13)
at createCliRenderer (../../node_modules/.bun/@[email protected]+81ecd8642a1892ca/node_modules/@opentui/core/index-xqg0a6ka.js:12508:18)
at createCliRenderer (../../node_modules/.bun/@[email protected]+81ecd8642a1892ca/node_modules/@opentui/core/index-xqg0a6ka.js:12499:34)
at <anonymous> (../../node_modules/.bun/@[email protected]+1753ef9b65046169/node_modules/@opentui/solid/index.js:904:26)
at render (../../node_modules/.bun/@[email protected]+1753ef9b65046169/node_modules/@opentui/solid/index.js:903:21)
at <anonymous> (src/cli/cmd/tui/app.tsx:101:5)
Tried installing with the install script and npm - both same results.
Device: M4 Pro MBP
Opencode version: 1.0.18
if you have this error on mac does this work touch $TMPDIR/test.dylib
I'm having this same error for windows. Same result from NPM & the bash script with curl; and for git-bash, cmd, and powershell.
@thdxr it is not allowed:
❯ touch $TMPDIR/test.dylib
touch: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T//test.dylib: Permission denied
hm wonder why this is the case
TMPDIR=/tmp opencode
this doesn't work either right?
@thdxr no no it works when running TMPDIR=/tmp opencode, that's it, can it work without issues after that?
❯ echo $TMPDIR
/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/
❯ ls -ld $TMPDIR
drwx------ 64 root wheel 2048 Nov 4 06:53 /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T//
❯ whoami
**** my username
btw, I didn't run any command in any restricted context, just open normal terminal and use it.
Having the same issue on one of my macs.
My personal one worked as expected(M3 Pro) but in the company one(M2 Max) I get the same error.
I think the issue might be because the company one is a managed macbook where I have restricted access. The touch shows Permissions Denied, but the TMPDIR=/tmp opencode works as expected.
By setting TMPDIR to /tmp, I can successfully run opencode
Same issue on windows. Was just running with much older version and decided to update and getting that error.
I just got the same error on Windows 11, but for me its the Windows security that is flagging malware.