diegosouzapw/OmniRoute · error

Failed to import credentials

Error message

Failed to import credentials

What it means

User-facing failure label shown by the OAuth credential-paste modal when POST /api/oauth/{provider}/paste-credentials rejects the submitted blob — the server-side decode/finalize/persist step failed, so the pasted credentials could not be imported as a provider connection. The detailed cause is in the server response.

Solutions

  1. Re-copy the credential blob — it may be truncated or corrupted in transit
  2. Confirm the blob belongs to the selected provider and has not expired
  3. Check server logs for the underlying decode/finalize error from paste-credentials
  4. Retry the paste after fixing the blob format expected by the provider's OAuth flow
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/shared/components/oauthBlobSubmit.ts:38 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/3cd7729f639ab673. Report an issue: GitHub.

Appendix: source

Thrown at src/shared/components/oauthBlobSubmit.ts:38

 * advances the modal to the success step and fires onSuccess; on failure it
 * THROWS so the caller's existing try/catch surfaces the error (keeps the modal
 * call site to two lines). Decoding + finalize + persist happen server-side.
 */
export async function submitCredentialBlob(
  provider: string,
  blob: string,
  reauthConnection: { id?: string } | null | undefined,
  setStep: (s: string) => void,
  onSuccess?: () => void
): Promise<void> {
  const res = await fetch(`/api/oauth/${provider}/paste-credentials`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ blob: blob.trim(), connectionId: reauthConnection?.id }),
  });
  const data = (await parseResponseBody(res)) as Record<string, unknown>;
  if (!res.ok) {
    throw new Error(getErrorMessage(data, res.status, "Failed to import credentials"));
  }
  setStep("success");
  onSuccess?.();
}

View on GitHub (pinned to a179ffed5b)