diegosouzapw/OmniRoute · error

decodeCredentialBlob: invalid format — must start with "${CR

Error message

decodeCredentialBlob: invalid format — must start with "${CREDENTIAL_BLOB_PREFIX}"

What it means

Error "decodeCredentialBlob: invalid format — must start with "${CREDENTIAL_BLOB_PREFIX}"" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/oauth/credentialBlob.ts:71

  }
  const payload = {
    v: CREDENTIAL_BLOB_VERSION,
    provider: input.provider.trim(),
    tokens: input.tokens,
  };
  const json = JSON.stringify(payload);
  const b64 = Buffer.from(json, "utf8").toString("base64url");
  return `${CREDENTIAL_BLOB_PREFIX}${b64}`;
}

/**
 * Decode a credential blob produced by {@link encodeCredentialBlob}.
 * Validates the prefix, version, JSON shape, and the presence of an access_token.
 * Throws a descriptive error on any malformed/tampered/unsupported input.
 */
export function decodeCredentialBlob(blob: string): CredentialBlob {
  if (typeof blob !== "string" || !blob.startsWith(CREDENTIAL_BLOB_PREFIX)) {
    throw new Error(
      `decodeCredentialBlob: invalid format — must start with "${CREDENTIAL_BLOB_PREFIX}"`
    );
  }
  const b64 = blob.slice(CREDENTIAL_BLOB_PREFIX.length).trim();
  if (!/^[A-Za-z0-9_-]+$/.test(b64)) {
    throw new Error("decodeCredentialBlob: invalid payload — not base64url");
  }

  let parsed: { v?: unknown; provider?: unknown; tokens?: unknown };
  try {
    const json = Buffer.from(b64, "base64url").toString("utf8");
    parsed = JSON.parse(json);
  } catch {
    throw new Error("decodeCredentialBlob: invalid payload — could not parse JSON");
  }

  if (parsed.v !== CREDENTIAL_BLOB_VERSION) {
    throw new Error(

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/oauth/credentialBlob.ts:71 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/93b8877975ca500d. Report an issue: GitHub.