HKUDS/Vibe-Trading · error · HTTPException

Session runtime not enabled

Error message

Session runtime not enabled

What it means

The channel runtime cannot start because the session service is unavailable in this process, so the API returns 501 Not Implemented. _get_channel_runtime depends on _get_session_service(); when session support isn't initialized (feature disabled or missing dependency), svc is None and this error is thrown before any channel manager is built.

Source

Thrown at agent/src/api/state.py:121

    global _channel_runtime, _channel_bus, _channel_manager

    import sys as _sys
    _host = _sys.modules.get("api_server")
    if _host is not None and hasattr(_host, "_channel_runtime"):
        host_rt = getattr(_host, "_channel_runtime")
        if host_rt is not None:
            return host_rt
    elif _channel_runtime is not None:
        return _channel_runtime

    from src.channels.bus.queue import MessageBus
    from src.channels.config import load_channels_config
    from src.channels.manager import ChannelManager
    from src.channels.runtime import ChannelRuntime

    svc = _get_session_service()
    if not svc:
        raise HTTPException(status_code=501, detail="Session runtime not enabled")

    _channel_bus = MessageBus()
    config = load_channels_config()
    _channel_manager = ChannelManager(config, _channel_bus, session_service=svc)
    global_operators, channel_operators = ChannelRuntime.operators_from_config(config)
    _channel_runtime = ChannelRuntime(
        bus=_channel_bus,
        session_service=svc,
        manager=_channel_manager,
        reply_timeout_s=config["reply_timeout_s"],
        operators=global_operators,
        channel_operators=channel_operators,
    )
    _set_host_attr("_channel_runtime", _channel_runtime)
    _set_host_attr("_channel_bus", _channel_bus)
    _set_host_attr("_channel_manager", _channel_manager)
    return _channel_runtime

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Enable/configure the session runtime (session backend settings/env vars) and restart the server
  2. Check server startup logs for session service initialization errors
  3. Upgrade/verify the deployment includes the session component this endpoint requires
Defensive patterns

Strategy: try-catch

Try / catch

try:
    runtime = get_channel_runtime()
except HTTPException as e:
    if e.status_code == 501:
        disable_channel_ui()  # session runtime unavailable in this deployment
    else:
        raise

Prevention

When it happens

Trigger: Calling any /channels or session-dependent endpoint while the session service failed to initialize or is disabled in this deployment (e.g. missing session backend config).

Common situations: Running the API server without session runtime configured, a partial deployment where session env vars are absent, or a version where session features are gated off.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/468dc1a71b0478e1. Report an issue: GitHub.