{"record":{"id":"8f639a187ac4d206","repo":"diegosouzapw/OmniRoute","slug":"server-full","errorCode":"SERVER_FULL","errorMessage":"Max clients reached","messagePattern":"Max clients reached","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/server/ws/liveServer.ts","lineNumber":524,"sourceCode":"      }\n      handleMessage(activeClientId, raw);\n    });\n\n    // Origin check — browsers always send Origin on the WS upgrade; reject\n    // unknown origins to stop drive-by cross-origin WebSocket from a victim\n    // page. Non-browser clients (CLI / MCP) omit Origin and are accepted\n    // only when bound to loopback (see isOriginAllowed).\n    const origin = request.headers[\"origin\"];\n    const originStr = Array.isArray(origin) ? origin[0] : origin;\n    if (!isOriginAllowed(originStr)) {\n      sendTo(ws, { type: \"error\", code: \"FORBIDDEN_ORIGIN\", message: \"Origin not allowed\" });\n      ws.close(4003, \"Forbidden origin\");\n      return;\n    }\n\n    // Enforce max clients\n    if (clients.size >= MAX_CLIENTS) {\n      sendTo(ws, { type: \"error\", code: \"SERVER_FULL\", message: \"Max clients reached\" });\n      ws.close(1013, \"Server full\");\n      return;\n    }\n\n    // Authorize\n    const auth = await authorizeConnection(request);\n    if (!auth.authorized) {\n      sendTo(ws, { type: \"error\", code: \"UNAUTHORIZED\", message: auth.error || \"Unauthorized\" });\n      ws.close(4001, \"Unauthorized\");\n      return;\n    }\n\n    const clientId = auth.sessionId;\n    activeClientId = clientId;\n    const client: ClientState = {\n      ws,\n      sessionId: clientId,\n      subscribedChannels: new Set(),","sourceCodeStart":506,"sourceCodeEnd":542,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/server/ws/liveServer.ts#L506-L542","documentation":"WebSocket admission control: clients.size already reached MAX_CLIENTS, so the new connection gets a SERVER_FULL error frame and close code 1013. Capacity guard, not a protocol error — retry later once existing clients disconnect.","triggerScenarios":"Thrown at src/server/ws/liveServer.ts:524 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wait for existing clients to disconnect and reconnect","Close stale/idle dashboard tabs holding WS connections","Raise MAX_CLIENTS if the deployment legitimately needs more concurrent clients"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}