nextcloud/all-in-one · error · \Exception
A domain is already configured. Reset the AIO instance first
Error message
A domain is already configured. Reset the AIO instance first to register a new domain.
What it means
Thrown by DesecManager::register when the ConfigurationManager already has a non-empty domain configured. The deSEC registration flow (domain obtainment via the AIO interface) is one-shot per instance: once a domain is stored, re-running register would create a second account/domain, so it refuses and asks for an instance reset first.
Source
Thrown at php/src/Desec/DesecManager.php:43
}
/**
* Full registration flow: validates inputs, creates an account if needed,
* registers the domain, enables required containers, and updates the DNS record.
*
* When $password is non-empty the user is logging into an existing deSEC account
* rather than creating a new one. When $password is empty a new account is created
* with a randomly generated password (unless an account was already registered in a
* previous attempt).
*
* @return bool true when the domain was fully registered; false when a new account was
* just created and we are now awaiting the user's email verification (a normal,
* non-error outcome — the awaiting-verification UI explains the next step).
* @throws \Exception on any validation or API error
*/
public function register(string $email, string $slug, string $password = ''): bool {
if ($this->configurationManager->domain !== '') {
throw new \Exception('A domain is already configured. Reset the AIO instance first to register a new domain.');
}
$validatedSlug = $this->validateSlug($slug);
// Persist the requested slug so the form can pre-fill it when it re-renders on the
// next step of the flow (e.g. after email verification). Cleared once a domain is set.
$this->configurationManager->desecSlug = $validatedSlug;
[$token, $isNewAccount] = $this->obtainToken($email, $password);
// An empty token means a brand-new account was created but its email is not yet
// verified. That is not an error: the account state is already persisted, so report
// "awaiting verification" to the caller and let it re-render the awaiting UI.
if ($token === '') {
return false;
}
$domain = $this->registerDomain($token, $validatedSlug);View on GitHub (pinned to 6b788eec5e)
Solutions
- Check the current domain first (configurationManager->domain) and skip registration when it is set.
- If you genuinely need a new domain, reset the AIO instance first (which clears the stored domain), understanding that a reset has wider effects.
- For automation, make the register call idempotent by guarding on the existing domain state.
Example fix
// before
$desecManager->register($email, $slug, $password);
// after
if ($configurationManager->domain === '') {
$desecManager->register($email, $slug, $password);
} Defensive patterns
Strategy: validation
Validate before calling
if ($configurationManager->domain !== '') {
// skip register(); domain already set
} Try / catch
try {
$desecManager->register($email, $slug, $password);
} catch (\Exception $e) {
if (str_contains($e->getMessage(), 'A domain is already configured')) {
// not an error: proceed with existing domain
}
} Prevention
- Disable the submit button after success to prevent double POSTs.
- In scripts, query the configured domain before attempting registration.
When it happens
Trigger: Calling register() (via the AIO web UI domain/deSEC flow or directly) after a domain was already successfully set, including when the user re-submits the deSEC form after a partially completed earlier attempt that already stored the domain.
Common situations: Double-submitting the deSEC registration form; browser back/refresh resubmitting POST; retrying an automation script after it actually succeeded; a prior attempt that completed domain setup but showed an error to the user.
Related errors
- Please provide a valid email address.
- The desired subdomain must contain only lowercase letters, d
- Could not reach the deSEC API: {message}
- Unexpected response from deSEC during account registration (
- DNS config is not set for this domain or the domain is not a
AI-assisted analysis of nextcloud/all-in-one@6b788eec5e (2026-08-21).
Data as JSON: /api/errors/f22cb90b993983c8.
Report an issue: GitHub.