diegosouzapw/OmniRoute · error · Error

Invalid base62 character

Error message

Invalid base62 character: ${char}

What it means

Thrown by decodeBase62 in the muse-spark web executor: a character in the input string is not present in the 62-char base62 alphabet (0-9A-Za-z), so decoding to bigint is aborted. Reached from packedConversation, meaning a packed conversation id/token was corrupted, truncated, or produced by an incompatible encoder — not a transient failure.

Solutions

  1. Regenerate the packed conversation id — the stored value is corrupt; do not attempt to repair it.
  2. Find where the id was truncated (URL handling, DB column width, logging/serialization) and fix the lossy step.
  3. Validate input against /^[0-9A-Za-z]+$/ before calling decodeBase62 to fail with a clearer client error.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at open-sse/executors/muse-spark-web.ts:175 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at open-sse/executors/muse-spark-web.ts:175

function encodeBase62(value: bigint, padLength: number): string {
  let remaining = value;
  let encoded = "";

  while (remaining > 0n) {
    encoded = BASE62_ALPHABET[Number(remaining % 62n)] + encoded;
    remaining /= 62n;
  }

  return encoded.padStart(padLength, "0");
}

function decodeBase62(value: string): bigint {
  let decoded = 0n;
  for (const char of value) {
    const index = BASE62_ALPHABET.indexOf(char);
    if (index < 0) {
      throw new Error(`Invalid base62 character: ${char}`);
    }
    decoded = decoded * 62n + BigInt(index);
  }
  return decoded;
}

function randomBigInt(byteLength: number): bigint {
  const bytes = new Uint8Array(byteLength);
  crypto.getRandomValues(bytes);
  let result = 0n;
  for (const byte of bytes) {
    result = (result << 8n) | BigInt(byte);
  }
  return result;
}

function generateMetaConversationId(): string {
  const timestamp = BigInt(Date.now()) & ((1n << 44n) - 1n);

View on GitHub (pinned to a179ffed5b)