{"record":{"id":"4eb7cd03f01a4c9a","repo":"HKUDS/nanobot","slug":"the-configured-gateway-port-belongs-to-a-different","errorCode":null,"errorMessage":"the configured gateway port belongs to a different nanobot instance; stop that instance or use `nanobot agent --classic`","messagePattern":"the configured gateway port belongs to a different nanobot instance; stop that instance or use `nanobot agent --classic`","errorType":"exception","errorClass":"TuiUnavailableError","httpStatus":null,"severity":"error","filePath":"nanobot/cli/tui_launcher.py","lineNumber":430,"sourceCode":"        config_path=config_path,\n        workspace=workspace_override,\n    )\n    runtime = GatewayRuntime(paths=instance.paths)\n    lease = GatewayClientLease(runtime, kind=\"tui\")\n    lease.acquire()\n    try:\n        status = runtime.status()\n        endpoint_reachable = _webui_endpoint_reachable(base_url)\n        if status.running:\n            if status.port not in {None, config.gateway.port}:\n                raise TuiUnavailableError(\n                    \"the matching gateway instance is running on a different port; \"\n                    \"restart it or use `nanobot agent --classic`\"\n                )\n            if endpoint_reachable or not wait_until_ready:\n                return _GatewayHandle(base_url=base_url, lease=lease)\n        elif endpoint_reachable:\n            raise TuiUnavailableError(\n                \"the configured gateway port belongs to a different nanobot instance; \"\n                \"stop that instance or use `nanobot agent --classic`\"\n            )\n\n        result = lease.ensure_on_demand_gateway(\n            instance.start_options(port=config.gateway.port)\n        )\n        if not result.ok and result.message != \"gateway_already_running\":\n            raise TuiUnavailableError(\n                f\"could not start the local gateway ({result.message}); \"\n                f\"logs: {result.status.log_path}\"\n            )\n\n        if not wait_until_ready:\n            return _GatewayHandle(base_url=base_url, lease=lease)\n\n        deadline = time.monotonic() + 20\n        while time.monotonic() < deadline:","sourceCodeStart":412,"sourceCodeEnd":448,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/cli/tui_launcher.py#L412-L448","documentation":"Error \"the configured gateway port belongs to a different nanobot instance; stop that instance or use `nanobot agent --classic`\" thrown in HKUDS/nanobot.","triggerScenarios":"Thrown at nanobot/cli/tui_launcher.py:430 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"42f37dc4c0e409eac7818a82d165c5f2757bc075","analyzedAt":"2026-08-26T00:18:52.276Z","schemaVersion":2},"datasetVersion":"2026-08-26T04:18:47.238Z"}