paperclipai/paperclip · error · Error

BROKER_PROTECTED_PORTS contains an out-of-range port: ${toke

Error message

BROKER_PROTECTED_PORTS contains an out-of-range port: ${token}

What it means

parseProtectedPorts guard: a token parses numerically but the resulting port falls outside the valid TCP range. Because the broker would then be protecting a port that can't exist, startup aborts to surface the operator typo.

Source

Thrown at packages/tailscale-https-broker/src/port-policy.ts:40

 * set of operator-protected ports (PAP-17285).
 *
 * Fails closed: a malformed list throws so the broker refuses to start rather
 * than silently protecting nothing. Protecting a port the broker cannot mutate
 * anyway is harmless, so no range restriction is applied — but `443` is rejected
 * because the primary route has its own stronger, non-optional invariant and
 * listing it here would imply it were opt-in.
 */
export function parseProtectedPorts(raw: string | undefined): number[] {
  if (raw === undefined) return [];
  const tokens = raw.split(/[,\s]+/).filter((token) => token.length > 0);
  const ports = new Set<number>();
  for (const token of tokens) {
    if (!/^[0-9]{1,5}$/.test(token)) {
      throw new Error(`BROKER_PROTECTED_PORTS contains a non-numeric entry: ${JSON.stringify(token)}`);
    }
    const port = Number(token);
    if (port < 1 || port > 65535) {
      throw new Error(`BROKER_PROTECTED_PORTS contains an out-of-range port: ${token}`);
    }
    if (port === 443) {
      throw new Error("BROKER_PROTECTED_PORTS must not list 443; the primary route is always protected");
    }
    ports.add(port);
  }
  return [...ports].sort((a, b) => a - b);
}

View on GitHub (pinned to 120ae5428f)

Solutions

  1. Change the listed entry in BROKER_PROTECTED_PORTS to a valid port number within 1-65535.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/tailscale-https-broker/src/port-policy.ts:40 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18). Data as JSON: /api/errors/be7728139c62b4e6. Report an issue: GitHub.