invoke-ai/InvokeAI · error · HTTPException
Administrator account already configured
Error message
Administrator account already configured
What it means
HTTP 400 raised by the POST /auth/setup endpoint in invokeai/app/api/routers/auth.py:384. InvokeAI allows exactly one administrator account, created through the one-time setup flow. If `user_service.has_admin()` reports an existing admin, the setup endpoint refuses to create another one with this detail message.
Source
Thrown at invokeai/app/api/routers/auth.py:384
Raises:
HTTPException: 400 if admin already exists or password is weak
HTTPException: 403 if multiuser mode is disabled
"""
config = ApiDependencies.invoker.services.configuration
# Check if multiuser is enabled
if not config.multiuser:
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail="Multiuser mode is disabled. Admin setup is not required in single-user mode.",
)
user_service = ApiDependencies.invoker.services.users
# Check if any admin exists
if user_service.has_admin():
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail="Administrator account already configured",
)
# Create admin user - this will validate password strength
try:
user_data = UserCreateRequest(
email=request.email,
display_name=request.display_name,
password=request.password,
is_admin=True,
)
user = user_service.create_admin(user_data, strict_password_checking=config.strict_password_checking)
except ValueError as e:
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=str(e)) from e
return SetupResponse(success=True, user=user)
View on GitHub (pinned to 0b6a024f2f)
Solutions
- Skip the setup call — log in with the existing admin account instead.
- If the admin password is lost, use the existing password-reset flow rather than re-running setup.
- If the existing admin row is stale/corrupt, remove or demote it via the user-management endpoints (PATCH/DELETE /users/{id}) so has_admin() returns false, then re-run setup.
- As a last resort on a dev instance, delete/reset the users table (or the SQLite db file invokeai.db) and re-run setup.
- Guard client code: check setup status (GET setup endpoint) before POSTing.
Example fix
// before: blind setup call on an already-initialized instance
await fetch('/api/v1/auth/setup', {method:'POST', body: JSON.stringify(payload)});
// after: only setup when no admin exists yet
const status = await (await fetch('/api/v1/auth/setup')).json();
if (status.needs_setup /* no admin */) {
await fetch('/api/v1/auth/setup', {method:'POST', body: JSON.stringify(payload)});
} Defensive patterns
Strategy: validation
Validate before calling
// Only attempt setup when no admin exists
const probe = await fetch('/api/v1/auth/setup');
const info = await probe.json();
if (!info.needs_setup) return; // admin already configured
await fetch('/api/v1/auth/setup', {method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify(payload)}); Try / catch
try {
await setupAdmin(payload);
} catch (e) {
if (e.status === 400 && e.detail === 'Administrator account already configured') {
// setup already done — proceed to login
} else throw e;
} Prevention
- Check setup status before POSTing to /auth/setup
- Run setup exactly once, from a single place (one bootstrap script, not every deploy)
- Never use setup as a password-reset mechanism
- Track 'instance initialized' state in your deploy tooling
When it happens
Trigger: Calling POST /api/v1/auth/setup (setup_admin) when the database already contains an active user with is_admin=true — i.e. after setup has already been completed.
Common situations: Re-running the setup wizard after the admin was already created; a second browser tab or CI script racing to call setup; restoring a database that already has an admin and then re-running setup; forgetting the admin password and trying to create a new admin via setup instead of using the password reset.
Related errors
- str(e)
- The system user cannot be deleted, deactivated, promoted to
- Cannot remove the last administrator
- Current password is required to set a new password
- Invalid preset data
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/1cfc72e8cae81979.
Report an issue: GitHub.