[GH-ISSUE #277] Bun crash on cmd+v #70

Closed
opened 2026-03-02 23:44:20 +03:00 by kerem · 2 comments
Owner

Originally created by @pnodet on GitHub (Nov 7, 2025).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/277

Code

	const [code, setCode] = useState('');
  	const [error, setError] = useState('');

	  useKeyboard(key => {
	    if (key.name === 'return') {
	      if (code.trim().length === 0) {
	        setError('Code cannot be empty');
	        return;
	      }
	
	      try {
	        saveConfig({ userCode: code.trim() });
	        onComplete();
	      } catch {
	        setError('Failed to save configuration');
	      }
	    } else if (key.name === 'backspace') {
	      setCode(prev => prev.slice(0, -1));
	      setError('');
	    } else if (key.name === 'escape') {
	      process.exit(0);
	    } else if (key.sequence && key.sequence.length === 1) {
	      setCode(prev => prev + key.sequence);
	      setError('');
	    }
	  });

	return (
        <box flexDirection='column' marginBottom={1}>
          <text attributes={TextAttributes.BOLD}>
            Enter your code:
          </text>
          <box
            border
            marginTop={1}
            paddingLeft={1}
            paddingRight={1}
            style={{ backgroundColor: '#1f2335' }}
          >
            <text>{code || ' '}</text>
          </box>
        </box>
	)

Env

❯ npx envinfo --system --binaries --npmPackages @opentui/core,@opentui/react,react

  System:
    OS: macOS 26.0.1
    CPU: (14) arm64 Apple M4 Pro
    Memory: 161.48 MB / 24.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.21.0 - /Users/pnodet/.local/state/fnm_multishells/43625_1762510310051/bin/node
    npm: 10.9.4 - /Users/pnodet/.local/state/fnm_multishells/43625_1762510310051/bin/npm
    bun: 1.2.13 - /etc/profiles/per-user/pnodet/bin/bun
    Deno: 2.2.12 - /etc/profiles/per-user/pnodet/bin/deno
  npmPackages:
    @opentui/core: 0.1.36 => 0.1.36
    @opentui/react: 0.1.36 => 0.1.36
    react: 19.2.0 => 19.2.0

Logs

Console (Focused)
	[11:10:241 [ERROR] Error: Bun.stripANSI is not a function. (In 'Bun.stripANSI(data)', 'Bun.stripANSI' is undefined)
	TypeError: Bun.stripANSI is not a function. (In 'Bun.stripANSI(data)', 'Bun.stripANSI' is undefined)
	at processSequence (/Users/pnodet/git/nivalis/nivalis-vercel-tui/node_modules/@opentui/src/lib/KeyHandler.ts:104:33)
	at <anonymous› (/Users/pnodet/git/nivalis/nivalis-vercel-tui/node_modules/@opentui/src/lib/KeyHandler.ts:94:12)
	at emit (node:events:89:22)
	at handleData (/Users/pnodet/git/nivalis/nivalis-vercel-tui/node_modules/@opentui/src/lib/stdin-buffer.ts:242:12) at <anonymous› (/Users/pnodet/git/nivalis/nivalis-vercel-tui/node_modules/@opentui/src/lib/stdin-buffer.ts:203:12)
	at emit (node:events:89:22)
	at addChunk (internal:streams/readable:265:47)
	at readableAddChunkPushByteMode (internal:streams/readable:243:18)
	at internalRead (native:39:40)
	at processTicksAndRejections (native:7:39)
Originally created by @pnodet on GitHub (Nov 7, 2025). Original GitHub issue: https://github.com/anomalyco/opentui/issues/277 ### Code ```ts const [code, setCode] = useState(''); const [error, setError] = useState(''); useKeyboard(key => { if (key.name === 'return') { if (code.trim().length === 0) { setError('Code cannot be empty'); return; } try { saveConfig({ userCode: code.trim() }); onComplete(); } catch { setError('Failed to save configuration'); } } else if (key.name === 'backspace') { setCode(prev => prev.slice(0, -1)); setError(''); } else if (key.name === 'escape') { process.exit(0); } else if (key.sequence && key.sequence.length === 1) { setCode(prev => prev + key.sequence); setError(''); } }); return ( <box flexDirection='column' marginBottom={1}> <text attributes={TextAttributes.BOLD}> Enter your code: </text> <box border marginTop={1} paddingLeft={1} paddingRight={1} style={{ backgroundColor: '#1f2335' }} > <text>{code || ' '}</text> </box> </box> ) ``` ### Env ```sh ❯ npx envinfo --system --binaries --npmPackages @opentui/core,@opentui/react,react System: OS: macOS 26.0.1 CPU: (14) arm64 Apple M4 Pro Memory: 161.48 MB / 24.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 22.21.0 - /Users/pnodet/.local/state/fnm_multishells/43625_1762510310051/bin/node npm: 10.9.4 - /Users/pnodet/.local/state/fnm_multishells/43625_1762510310051/bin/npm bun: 1.2.13 - /etc/profiles/per-user/pnodet/bin/bun Deno: 2.2.12 - /etc/profiles/per-user/pnodet/bin/deno npmPackages: @opentui/core: 0.1.36 => 0.1.36 @opentui/react: 0.1.36 => 0.1.36 react: 19.2.0 => 19.2.0 ``` ### Logs ```sh Console (Focused) [11:10:241 [ERROR] Error: Bun.stripANSI is not a function. (In 'Bun.stripANSI(data)', 'Bun.stripANSI' is undefined) TypeError: Bun.stripANSI is not a function. (In 'Bun.stripANSI(data)', 'Bun.stripANSI' is undefined) at processSequence (/Users/pnodet/git/nivalis/nivalis-vercel-tui/node_modules/@opentui/src/lib/KeyHandler.ts:104:33) at <anonymous› (/Users/pnodet/git/nivalis/nivalis-vercel-tui/node_modules/@opentui/src/lib/KeyHandler.ts:94:12) at emit (node:events:89:22) at handleData (/Users/pnodet/git/nivalis/nivalis-vercel-tui/node_modules/@opentui/src/lib/stdin-buffer.ts:242:12) at <anonymous› (/Users/pnodet/git/nivalis/nivalis-vercel-tui/node_modules/@opentui/src/lib/stdin-buffer.ts:203:12) at emit (node:events:89:22) at addChunk (internal:streams/readable:265:47) at readableAddChunkPushByteMode (internal:streams/readable:243:18) at internalRead (native:39:40) at processTicksAndRejections (native:7:39) ```
kerem closed this issue 2026-03-02 23:44:20 +03:00
Author
Owner

@msmps commented on GitHub (Nov 7, 2025):

@pnodet I think you’ll need to update your bun version.

<!-- gh-comment-id:3501670064 --> @msmps commented on GitHub (Nov 7, 2025): @pnodet I think you’ll need to update your bun version.
Author
Owner

@pnodet commented on GitHub (Nov 7, 2025):

Indeed. Upgrading to 1.3.1 fixed my issue!

<!-- gh-comment-id:3501774066 --> @pnodet commented on GitHub (Nov 7, 2025): Indeed. Upgrading to 1.3.1 fixed my issue!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#70
No description provided.