{"record":{"id":"0aa8d3d134ddd529","repo":"diegosouzapw/OmniRoute","slug":"unauthorized","errorCode":"UNAUTHORIZED","errorMessage":"${auth.error || \"Unauthorized\"}","messagePattern":"\\$\\{auth\\.error \\|\\| \"Unauthorized\"\\}","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/server/ws/liveServer.ts","lineNumber":532,"sourceCode":"    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(),\n      lastActivity: Date.now(),\n      eventCounter: 0,\n      eventCounterReset: Date.now(),\n      remoteAddress: request.socket?.remoteAddress || \"unknown\",\n    };\n\n    clients.set(clientId, client);\n","sourceCodeStart":514,"sourceCodeEnd":550,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/server/ws/liveServer.ts#L514-L550","documentation":"Error \"${auth.error || \"Unauthorized\"}\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/server/ws/liveServer.ts:532 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":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}