{"record":{"id":"468dc1a71b0478e1","repo":"HKUDS/Vibe-Trading","slug":"session-runtime-not-enabled-468dc1","errorCode":null,"errorMessage":"Session runtime not enabled","messagePattern":"Session runtime not enabled","errorType":"http","errorClass":"HTTPException","httpStatus":501,"severity":"error","filePath":"agent/src/api/state.py","lineNumber":121,"sourceCode":"    global _channel_runtime, _channel_bus, _channel_manager\n\n    import sys as _sys\n    _host = _sys.modules.get(\"api_server\")\n    if _host is not None and hasattr(_host, \"_channel_runtime\"):\n        host_rt = getattr(_host, \"_channel_runtime\")\n        if host_rt is not None:\n            return host_rt\n    elif _channel_runtime is not None:\n        return _channel_runtime\n\n    from src.channels.bus.queue import MessageBus\n    from src.channels.config import load_channels_config\n    from src.channels.manager import ChannelManager\n    from src.channels.runtime import ChannelRuntime\n\n    svc = _get_session_service()\n    if not svc:\n        raise HTTPException(status_code=501, detail=\"Session runtime not enabled\")\n\n    _channel_bus = MessageBus()\n    config = load_channels_config()\n    _channel_manager = ChannelManager(config, _channel_bus, session_service=svc)\n    global_operators, channel_operators = ChannelRuntime.operators_from_config(config)\n    _channel_runtime = ChannelRuntime(\n        bus=_channel_bus,\n        session_service=svc,\n        manager=_channel_manager,\n        reply_timeout_s=config[\"reply_timeout_s\"],\n        operators=global_operators,\n        channel_operators=channel_operators,\n    )\n    _set_host_attr(\"_channel_runtime\", _channel_runtime)\n    _set_host_attr(\"_channel_bus\", _channel_bus)\n    _set_host_attr(\"_channel_manager\", _channel_manager)\n    return _channel_runtime\n","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/api/state.py#L103-L139","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Enable/configure the session runtime (session backend settings/env vars) and restart the server","Check server startup logs for session service initialization errors","Upgrade/verify the deployment includes the session component this endpoint requires"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    runtime = get_channel_runtime()\nexcept HTTPException as e:\n    if e.status_code == 501:\n        disable_channel_ui()  # session runtime unavailable in this deployment\n    else:\n        raise","preventionTips":["Health-check session/channel endpoints at startup and degrade gracefully","Document which env/config enables the session runtime per deployment","Fail fast in config validation when channels are requested without session support"],"tags":["http-501","session-runtime","feature-disabled","channels"],"backgroundTag":"feature-not-enabled","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}