moeru-ai/airi · error · Error
deleteUser failed
Error message
deleteUser failed
What it means
Wraps authClient.deleteUser({ callbackURL }); the literal fires only when better-auth's error has no message. Deletion runs server-side and the user lands on the API-origin success page because the server cannot know which app origin (stage-web / stage-tamagotchi / stage-pocket) initiated the request.
Source
Thrown at packages/stage-pages/src/pages/settings/account/account-settings-page.vue:392
async function handleConfirmDelete(event: Event) {
event.preventDefault()
if (deleteLoading.value || !deleteEmailMatches.value)
return
deleteError.value = null
deleteLoading.value = true
try {
// The success page lives on the API-server origin (shared
// ui-server-auth bundle). It tells the user the deletion completed
// and asks them to close the tab — there is no "back to home"
// because the API server has no reliable way to know which calling
// app origin (stage-web / stage-tamagotchi / stage-pocket) the
// request came from.
const callbackURL = new URL('/auth/delete-account', SERVER_URL).toString()
const { error } = await authClient.deleteUser({ callbackURL })
if (error)
throw new Error(error.message ?? 'deleteUser failed')
deleteSent.value = true
deleteDialogOpen.value = false
trackAccountDeletionRequested()
}
catch (error) {
deleteError.value = errorMessageFrom(error) ?? t('settings.pages.account.danger.deleteAccount.error.fallback')
}
finally {
deleteLoading.value = false
}
}
</script>
<template>
<div :class="['flex flex-col gap-6', 'p-4']">
<template v-if="isAuthenticated">
<!-- 2-col layout on md+; pure single-column on mobile. The sidebar isView on GitHub (pinned to 677329427f)
Solutions
- Re-authenticate and retry the deletion.
- Log error.status/code from deleteUser to identify the rejection reason.
- Confirm the auth server is up and the delete-account route/plugin is enabled.
- Verify callbackURL builds correctly from SERVER_URL.
Defensive patterns
Strategy: try-catch
Validate before calling
if (!authStore.user) {
deleteError.value = 'Session expired — sign in again'
return
} Try / catch
catch (error) {
if ((error as { status?: number })?.status === 401)
await redirectToSignIn()
else
deleteError.value = errorMessageFrom(error) ?? t('settings.pages.account.danger.deleteAccount.error.fallback')
} Prevention
- Require a fresh session before destructive account actions.
- Keep the confirmation dialog explicit about irreversibility.
- Track deletion requests (the page already calls trackAccountDeletionRequested) for support debugging.
When it happens
Trigger: Expired session (401); the server requiring recent re-auth or an additional factor for deletion; auth server unreachable; user abandons the email-confirmation flow where that plugin is enabled.
Common situations: Long-lived settings tab with a stale session; auth server restart mid-flow; custom better-auth plugins adding deletion constraints.
Related errors
- updateUser failed
- changePassword failed
- requestPasswordReset failed
- listAccounts failed
- unlinkAccount failed
AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18).
Data as JSON: /api/errors/a5903faebc7513a0.
Report an issue: GitHub.