HKUDS/nanobot · error · TuiSessionError

the native TUI can open only WebSocket sessions; use --class

Error message

the native TUI can open only WebSocket sessions; use --classic to resume {session_id!r}

What it means

Error "the native TUI can open only WebSocket sessions; use --classic to resume {session_id!r}" thrown in HKUDS/nanobot.

Source

Thrown at nanobot/cli/tui_launcher.py:492

    try:
        port = int(settings.get("port") or 8765)
    except (TypeError, ValueError):
        port = 8765
    secret = str(
        settings.get("tokenIssueSecret")
        or settings.get("token_issue_secret")
        or settings.get("token")
        or ""
    ).strip()
    return f"http://{host}:{port}", secret


def _websocket_chat_id(session_id: str) -> str | None:
    """Map the CLI selector to the WebSocket namespace used by the native TUI."""
    if session_id.startswith("websocket:"):
        return session_id.split(":", 1)[1] or None
    if ":" in session_id:
        raise TuiSessionError(
            "the native TUI can open only WebSocket sessions; use --classic to resume "
            f"{session_id!r}"
        )
    return session_id or None


def _initial_tui_chat_id(session_id: str | None) -> str | None:
    """Start fresh unless the caller explicitly selects a TUI chat."""
    if session_id is not None:
        return _websocket_chat_id(session_id)
    return None


def _initial_tui_workspace(workspace_override: str | None) -> Path:
    """Use the launch directory unless the caller explicitly selects a workspace."""
    workspace = Path(workspace_override) if workspace_override is not None else Path.cwd()
    return workspace.expanduser().resolve(strict=False)

View on GitHub (pinned to 42f37dc4c0)

When it happens

Trigger: Thrown at nanobot/cli/tui_launcher.py:492 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HKUDS/nanobot@42f37dc4c0 (2026-08-26). Data as JSON: /api/errors/10abe65df74be307. Report an issue: GitHub.