diegosouzapw/OmniRoute · error

PARSE_ERROR

PARSE_ERROR

Error message

Invalid JSON

What it means

The live WebSocket server failed to JSON.parse an incoming client message; it replies with a PARSE_ERROR frame and skips the message. The raw payload was malformed rather than the expected {type,...} envelope.

Solutions

  1. Send valid JSON matching the WS client message schema
  2. Check the client serializer for binary/truncated frames
  3. Log the raw frame client-side to find the malformed producer
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/server/ws/liveServer.ts:226 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/dfc94d7b5e39ed3b. Report an issue: GitHub.

Appendix: source

Thrown at src/server/ws/liveServer.ts:226

  if (!client) return;

  // Rate limiting
  const now = Date.now();
  if (now - client.eventCounterReset > 1000) {
    client.eventCounter = 0;
    client.eventCounterReset = now;
  }
  client.eventCounter++;
  if (client.eventCounter > MAX_EVENTS_PER_SECOND) {
    sendTo(client.ws, { type: "error", code: "RATE_LIMITED", message: "Too many messages" });
    return;
  }

  let msg: WsClientMessage;
  try {
    msg = JSON.parse(raw);
  } catch {
    sendTo(client.ws, { type: "error", code: "PARSE_ERROR", message: "Invalid JSON" });
    return;
  }

  client.lastActivity = now;

  switch (msg.type) {
    case "subscribe": {
      client.subscribedChannels = new Set(msg.channels);

      // Send buffered events that match subscribed channels
      const relevantHistory = eventHistoryBacklog.filter((h) => {
        const ch = getChannelForEvent(h.event as DashboardEventName);
        return ch && msg.channels.includes(ch);
      });

      sendTo(client.ws, {
        type: "welcome",
        version: "1.0.0",

View on GitHub (pinned to a179ffed5b)