overleaf/overleaf · error · CodedError

error.info.code

error.info.code

Error message

error.message

What it means

In real-time Router._handleError's validation branch: error.message is extracted from the first Zod issue of a Zod-like validation error detected by isZodErrorLike. It is a generic guard — the fault is an invalid argument payload for the realtime method, and the first issue's message is serialized back to the client as { message } with a validation-error metric.

Source

Thrown at services/real-time/app/js/Router.js:58

    attrs.client_id = client.id
    attrs.err = error
    attrs.method = method
    if (attrs.validation && isZodErrorLike(error)) {
      logger.info(attrs, 'validation error')
      let message = 'invalid'
      try {
        message = error.issues[0].message
      } catch (e) {
        // ignore unexpected errors
        logger.warn({ error, e }, 'unexpected validation error')
      }
      const serializedError = { message }
      metrics.inc('validation-error', 1, {
        status: method,
      })
      callback(serializedError)
    } else if (error.name === 'CodedError') {
      logger.warn(attrs, error.message)
      const serializedError = { message: error.message, code: error.info.code }
      callback(serializedError)
    } else if (error.message === 'unexpected arguments') {
      // the payload might be very large; put it on level debug
      logger.debug(attrs, 'unexpected arguments')
      metrics.inc('unexpected-arguments', 1, { status: method })
      const serializedError = { message: error.message }
      callback(serializedError)
    } else if (error.message === 'no project_id found on client') {
      logger.debug(attrs, error.message)
      const serializedError = { message: error.message }
      callback(serializedError)
    } else if (
      [
        'not authorized',
        'joinLeaveEpoch mismatch',
        'doc updater could not load requested ops',
        'no project_id found on client',

View on GitHub (pinned to 28ad3b03b7)

Solutions

  1. Log/inspect error.issues to see every failing field, not just the first
  2. Fix the client payload to satisfy the Zod schema for the realtime method
  3. Keep the method's Zod schema in sync with the documented message contract
  4. Add schema tests so payload regressions are caught before deploy
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at services/real-time/app/js/Router.js:58 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of overleaf/overleaf@28ad3b03b7 (2026-09-03). Data as JSON: /api/errors/447eadddd52e6c3b. Report an issue: GitHub.