{"record":{"id":"3c3946dfa267b2b9","repo":"diegosouzapw/OmniRoute","slug":"encodecredentialblob-tokens-object-is-required","errorCode":null,"errorMessage":"encodeCredentialBlob: tokens object is required","messagePattern":"encodeCredentialBlob: tokens object is required","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/oauth/credentialBlob.ts","lineNumber":52,"sourceCode":"  scope?: string;\n  [key: string]: unknown;\n}\n\nexport interface CredentialBlob {\n  provider: string;\n  tokens: CredentialBlobTokens;\n}\n\n/**\n * Encode a provider + raw OAuth token response into a single-line blob.\n * Throws if `provider` is missing — a blob with no provider cannot be routed.\n */\nexport function encodeCredentialBlob(input: CredentialBlob): string {\n  if (!input || typeof input.provider !== \"string\" || !input.provider.trim()) {\n    throw new Error(\"encodeCredentialBlob: a non-empty provider is required\");\n  }\n  if (!input.tokens || typeof input.tokens !== \"object\") {\n    throw new Error(\"encodeCredentialBlob: tokens object is required\");\n  }\n  const payload = {\n    v: CREDENTIAL_BLOB_VERSION,\n    provider: input.provider.trim(),\n    tokens: input.tokens,\n  };\n  const json = JSON.stringify(payload);\n  const b64 = Buffer.from(json, \"utf8\").toString(\"base64url\");\n  return `${CREDENTIAL_BLOB_PREFIX}${b64}`;\n}\n\n/**\n * Decode a credential blob produced by {@link encodeCredentialBlob}.\n * Validates the prefix, version, JSON shape, and the presence of an access_token.\n * Throws a descriptive error on any malformed/tampered/unsupported input.\n */\nexport function decodeCredentialBlob(blob: string): CredentialBlob {\n  if (typeof blob !== \"string\" || !blob.startsWith(CREDENTIAL_BLOB_PREFIX)) {","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/credentialBlob.ts#L34-L70","documentation":"Error \"encodeCredentialBlob: tokens object is required\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/oauth/credentialBlob.ts:52 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}