Skip to content

tui: Maximum call stack size exceeded when rendering a list #51228

Description

@artemishack

Summary

The TUI crashed with RangeError: Maximum call stack size exceeded. while rendering a list. The stack trace shows unbounded recursion between applyListRenderable and applyListItemChildren (list rendering in the TUI), which points to a rendering path that recurses infinitely instead of terminating.

Environment

  • opencode version: 2.0.16
  • OS: Windows 10.0.26200 (x64) — Microsoft Windows NT 10.0.26200.0
  • Terminal: TERM=xterm-256color (TERM_PROGRAM unset)
  • Shell: cmd.exe (C:\WINDOWS\system32\cmd.exe)
  • Install/channel: release (latest)
  • Active plugins: None found

Reproduction

Reported automatically from the OpenCode crash screen; the exact action that triggered the crash is unknown. The crash occurs inside list rendering (applyListRenderable → applyListItemChildren → applyListRenderable …), so any screen that renders a list whose items contain list children could be a candidate (models/sessions list, markdown response with nested lists, dialog with list items).

  1. Open the TUI in a terminal.
  2. Trigger rendering of a list (e.g. open a list-based screen or render a message containing nested list items).
  3. Observe the crash.

Expected Behavior

Lists render without error; deeply nested or self-referential list structures terminate gracefully.

Actual Behavior

The TUI crashes with the crash screen:

RangeError: Maximum call stack size exceeded.
    at applyListItemRenderable (B:/~BUN/root/chunk-dw5ecpqt.js:71:3220)
    at applyListRenderable (B:/~BUN/root/chunk-dw5ecpqt.js:71:2285)
    at applyListItemChildren (B:/~BUN/root/chunk-dw5ecpqt.js:71:3811)
    at applyListRenderable (B:/~BUN/root/chunk-dw5ecpqt.js:71:2285)
    at applyListItemChildren (B:/~BUN/root/chunk-dw5ecpqt.js:71:3811)
    at applyListRenderable (B:/~BUN/root/chunk-dw5ecpqt.js:71:2285)
    at applyListItemChildren (B:/~BUN/root/chunk-dw5ecpqt.js:71:3811)
    at applyListRenderable (B:/~BUN/root/chunk-dw5ecpqt.js:71:2285)
    at applyListItemChildren (B:/~BUN/root/chunk-dw5ecpqt.js:71:3811)
    at applyListRenderable (B:/~BUN/root/chunk-dw5ecpqt.js:71:2285)

Additional Context

  • The recursion alternates strictly between applyListRenderable and applyListItemChildren, i.e. a list whose item children re-enter the same list-apply path with no base case — likely a list node that contains itself (directly or via children) or a missing termination check in the renderable-apply loop.
  • Crash frequency: unknown (single report so far).
  • No workarounds tried.

Activity

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