{"record":{"id":"344c61bd5bf4ce1d","repo":"earendil-works/pi","slug":"piserver-serverid-must-not-be-empty","errorCode":null,"errorMessage":"PiServer serverId must not be empty","messagePattern":"PiServer serverId must not be empty","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/server/src/server.ts","lineNumber":382,"sourceCode":"\t\tif (error instanceof ProtocolValidationError) {\n\t\t\treturn { code: \"invalid_request\", message: error.message };\n\t\t}\n\t\tthis.reportError(error);\n\t\treturn { code: \"internal_error\", message: INTERNAL_SERVER_ERROR_MESSAGE };\n\t}\n\n\tprivate reportError(error: unknown): void {\n\t\ttry {\n\t\t\tthis.onError?.(error instanceof Error ? error : new Error(String(error)));\n\t\t} catch {\n\t\t\t// Error observers cannot affect server state.\n\t\t}\n\t}\n}\n\nfunction resolveOptions(options: PiServerOptions): { maxFrameLength: number; handshakeTimeoutMs: number } {\n\tif (!Array.isArray(options.listeners)) throw new TypeError(\"PiServer listeners must be an array\");\n\tif (options.serverId === \"\") throw new TypeError(\"PiServer serverId must not be empty\");\n\tconst maxFrameLength = options.maxFrameLength ?? DEFAULT_MAX_FRAME_LENGTH;\n\tif (!Number.isSafeInteger(maxFrameLength) || maxFrameLength <= 0 || maxFrameLength > MAX_UINT32) {\n\t\tthrow new TypeError(`PiServer maxFrameLength must be an integer between 1 and ${MAX_UINT32}`);\n\t}\n\tconst handshakeTimeoutMs = options.handshakeTimeoutMs ?? DEFAULT_HANDSHAKE_TIMEOUT_MS;\n\tif (\n\t\t!Number.isSafeInteger(handshakeTimeoutMs) ||\n\t\thandshakeTimeoutMs <= 0 ||\n\t\thandshakeTimeoutMs > MAX_TIMER_DELAY_MS\n\t) {\n\t\tthrow new TypeError(`PiServer handshakeTimeoutMs must be an integer between 1 and ${MAX_TIMER_DELAY_MS}`);\n\t}\n\treturn { maxFrameLength, handshakeTimeoutMs };\n}\n","sourceCodeStart":364,"sourceCodeEnd":397,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/server/src/server.ts#L364-L397","documentation":"Error \"PiServer serverId must not be empty\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/server/src/server.ts:382 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a non-empty serverId."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}