{"record":{"id":"6cdf4aadee9fc792","repo":"diegosouzapw/OmniRoute","slug":"invalid-meta-ai-base62-character-char","errorCode":null,"errorMessage":"Invalid Meta AI base62 character: ${char}","messagePattern":"Invalid Meta AI base62 character: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/providers/validation/metaAi.ts","lineNumber":31,"sourceCode":"\nexport function encodeMetaAiBase62(value: bigint, padLength: number): string {\n  let remaining = value;\n  let encoded = \"\";\n\n  while (remaining > 0n) {\n    encoded = META_AI_BASE62_ALPHABET[Number(remaining % 62n)] + encoded;\n    remaining /= 62n;\n  }\n\n  return encoded.padStart(padLength, \"0\");\n}\n\nexport function decodeMetaAiBase62(value: string): bigint {\n  let decoded = 0n;\n  for (const char of value) {\n    const index = META_AI_BASE62_ALPHABET.indexOf(char);\n    if (index < 0) {\n      throw new Error(`Invalid Meta AI base62 character: ${char}`);\n    }\n    decoded = decoded * 62n + BigInt(index);\n  }\n  return decoded;\n}\n\nexport function randomMetaAiBigInt(byteLength: number): bigint {\n  const bytes = new Uint8Array(byteLength);\n  crypto.getRandomValues(bytes);\n  let result = 0n;\n  for (const byte of bytes) {\n    result = (result << 8n) | BigInt(byte);\n  }\n  return result;\n}\n\nexport function generateMetaAiConversationId(): string {\n  const timestamp = BigInt(Date.now()) & ((1n << 44n) - 1n);","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/providers/validation/metaAi.ts#L13-L49","documentation":"decodeMetaAiBase62 iterates the input and throws when a character is not in META_AI_BASE62_ALPHABET — the value being decoded (e.g. a packed conversation id) is malformed or was not produced by the matching encoder.","triggerScenarios":"Thrown at src/lib/providers/validation/metaAi.ts:31 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the encoded value was not truncated or hand-modified","Re-encode with encodeMetaAiBase62 before decoding round-trip inputs","Validate/normalize the conversation id at the ingestion boundary"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}