Auth completion crashes with "Failed to execute 'postMessage'... could not be cloned" — masks real errors in OIDC, hybrid passkey, and passkey-MFA flows
Bug Description
Multiple, distinct login/auth-completion code paths all fail with the exact same generic browser error:
Failed to execute 'postMessage' on 'Window': [object Object] could not be cloned.
This appears to come from a shared "auth completion" relay component that tries to window.postMessage() a non-structured-cloneable payload (likely a raw Error/Response/credential object rather than a plain serialized value). The practical effect is that whenever one of these flows fails for any reason, the user only ever sees this unhelpful, generic message instead of the real cause — in one case below it completely masked a legitimate, actionable backend validation error.
The only login path that reliably works is a passkey used directly as the primary/first login factor via a browser extension (e.g. Bitwarden), which apparently bypasses this shared relay entirely.
Steps To Reproduce — three separate repros, same symptom
1) OIDC (Authentik) login
- Click "Login with Authentik" on the login page.
- The IdP redirect completes successfully — server log confirms:
HandleCallback: authentication successful subject=... email=... - Backend then rejects the login with a real, specific error:
OIDC login preparation failed error="email not verified by OIDC provider; cannot merge accounts"→POST /api/oidc/callbackreturns500. - The frontend never shows this real error. Instead the user sees the generic postMessage/clone error, with no indication of what actually went wrong or how to fix it (in our case: the IdP's
emailscope mapping needs to setemail_verified: true).
2) Passkey login via cross-device/hybrid transport
- On the login page, choosing a passkey stored via cross-device/hybrid transport (e.g. iCloud Keychain / "Apple Passwords") fails immediately with the same postMessage error — the browser's native passkey picker never gets a chance to complete.
- A same-device, extension-based passkey (Bitwarden) registered on the same account works fine as the primary login button.
3) Passkey as a 2FA/MFA step after password login
- Log in with username + password (local account).
- At the "use recovery code or passkey" step, choosing "use passkey" immediately throws the same postMessage error — before the native WebAuthn device picker even appears.
- Checked server logs for the relevant time window: no corresponding request reaches the backend at all, confirming this specific crash happens entirely client-side, before any network call is made.
Expected Behavior
- The postMessage call should not crash (payload should be serialized to a plain, structured-cloneable object).
- Whatever real error occurred server-side (like the OIDC email-verification failure in repro 1) should be surfaced to the user instead of being masked by this generic crash.
Arcane Version
v2.9.0
Installation Method
Docker Compose (Podman, rootless)
Environment Type
Local Docker (Single instance) — backend actually runs against a rootless Podman socket exposed at the conventional /var/run/docker.sock path inside the container.
Notes
Root cause for repro 1's underlying (masked) error, for reference: Authentik's default OpenID email scope mapping hardcodes email_verified: False unconditionally. Arcane's "Link OIDC with Existing Accounts" merge-by-email logic requires email_verified: true, so out-of-the-box Authentik + Arcane account-merge can never succeed unless the Authentik admin creates a custom scope mapping that overrides email_verified to true. That specific incompatibility might be worth a documentation note regardless of the postMessage bug.
Confirmed the password → passkey MFA failure (repro 3) on Arcane v2.10.2, with Bitwarden browser extension 2026.7.0 in Brave on Linux, backed by Vaultwarden. Passkey registration succeeds, but using that key as the second factor fails with:
Failed to execute 'postMessage' on 'Window': [object Object] could not be cloned.
For this specific MFA path, the cause is reactive Svelte data reaching the extension's WebAuthn bridge:
- The login page stores
mfaChallengein$state. frontend/src/lib/components/auth/mfa-challenge.sveltepasseschallenge.optionsdirectly tostartAuthentication().- SimpleWebAuthn converts credential IDs but retains nested
transportsvalues. Bitwarden's request mapper also retainstransportsbefore sending the payload throughpostMessage. - Those nested values can still be Svelte proxies, which cannot be structured-cloned.
The following one-line local change fixes this path:
const credential = await startAuthentication({
- optionsJSON: challenge.options as unknown as PublicKeyCredentialRequestOptionsJSON
+ optionsJSON: $state.snapshot(challenge.options) as unknown as PublicKeyCredentialRequestOptionsJSON
});
Validation:
- A focused reproduction using Svelte 5.57.0, SimpleWebAuthn/browser 13.3.0, and the extension's credential transport mapping fails with
DataCloneErrorbefore the change and passes with the snapshot. This is a serialization reproduction, not a real authenticator test. - The patched frontend and complete Docker image build successfully;
svelte-check-rsreports 0 errors and 0 warnings. - After deploying the patched image, the affected user successfully completed password + passkey MFA using the existing Bitwarden/Vaultwarden-held key. MFA remained enabled; no key re-registration or recovery-code bypass was needed.
This confirms a fix for repro 3 only; the OIDC and hybrid-transport paths described above were not tested.
AI assistance disclosure: diagnosis, patch preparation, and this report were assisted by OpenAI Codex. The affected user performed the actual MFA login and confirmed it works.
Same here, reproduced on Arcane v2.10.2 web login with Brave + Bitwarden.
Username/password is accepted, but the subsequent passkey MFA step immediately fails with:
"Authentication Failed Failed to execute 'postMessage' on 'Window': [object Object] could not be cloned."
I see no network activity for the failed passkey attempt and nothing relevant in the browser console.
Logging in directly with the passkey, skipping username/password, works.
I also checked the existing E2E tests: there is passkey/MFA coverage, but it appears to test direct passkey login after enabling MFA rather than the password → passkey MFA flow. Adding coverage for this path would probably prevent this kind of regression from reaching a stable release.