Skip to content

console.trace in fn.ts corrupts TUI display on schema validation failure #16841

Closed as not planned

Description

@diogosalazar

Description

The console.trace("schema validation failure stack trace:") added in PR #16401 (src/util/fn.ts:9) writes raw text to stderr, which corrupts the TUI display. The terminal becomes garbled and requires a window resize to force a repaint.

This fires from src/server/routes/session.ts:575 through the Hono validator chain. It happens intermittently during normal usage (subagent dispatches, session operations).

This is what it looks like:
Image

Steps to Reproduce

  1. Use OpenCode TUI with subagents/tasks
  2. Wait for a schema validation mismatch between the Hono route validator and the fn() service-level validator (seems to happen on session routes)
  3. TUI display becomes garbled -- stack trace text bleeds into the terminal
  4. Resizing the window forces a repaint and restores the display

Expected Behavior

Schema validation failures should be logged through the structured Log system (respecting log levels) rather than raw console.trace() to stderr, which conflicts with the TUI's terminal control.

Environment

Suggested Fix

Replace console.trace() with the structured logger so it respects log levels and doesn't write raw text to the TUI-controlled terminal. The stack trace information is valuable for debugging but should go through the proper logging channel.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 10, 2026
  2. github-actions commented on Mar 10, 2026

    @github-actions
    Contributor

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

    If you believe these are distinct issues, feel free to let a maintainer know.

  3. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. github-actions commented on Jul 4, 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