louislam/uptime-kuma · warning · Error
Uptime Kuma has been initialized. If you want to run setup a
Error message
Uptime Kuma has been initialized. If you want to run setup again, please delete the database.
What it means
Thrown by the 'setup' socket handler when the user table already contains at least one row (R.knex('user').count > 0). It prevents re-running initial setup on an already-initialized instance. The callback returns {ok:false, msg:'Uptime Kuma has been initialized...'}.
Source
Thrown at server/server.js:712
callback({
ok: false,
msg: error.message,
});
}
});
socket.on("needSetup", async (callback) => {
callback(needSetup);
});
socket.on("setup", async (username, password, callback) => {
try {
if (passwordStrength(password).value === "Too weak") {
throw new TranslatableError("passwordTooWeak");
}
if ((await R.knex("user").count("id as count").first()).count !== 0) {
throw new Error(
"Uptime Kuma has been initialized. If you want to run setup again, please delete the database."
);
}
let user = R.dispense("user");
user.username = username;
user.password = await passwordHash.generate(password);
await R.store(user);
needSetup = false;
callback({
ok: true,
msg: "successAdded",
msgi18n: true,
});
} catch (e) {
callback({View on GitHub (pinned to 6b5ea01557)
Solutions
- Gate the setup UI on the 'needSetup' value returned by the server; do not show setup once it is false.
- If you truly need to re-setup, delete the database as the message instructs (data loss).
- Ensure only the initial request reaches 'setup'; treat subsequent calls as errors.
- After successful setup, redirect all clients to the login page.
Example fix
// before
socket.emit('setup', user, pw, cb); // always called
// after
socket.emit('needSetup', (needSetup) => {
if (!needSetup) return router.push('/login');
socket.emit('setup', user, pw, cb);
}); Defensive patterns
Strategy: validation
Validate before calling
// Only call setup when the server reports it is needed
socket.emit('needSetup', (needSetup) => {
if (!needSetup) return router.push('/login');
// safe to proceed with setup
}); Type guard
function shouldOfferSetup(needSetup) {
return needSetup === true;
} Prevention
- Gate the setup screen on needSetup from the server.
- After setup success, navigate all clients to login.
- Never replay setup on an initialized instance.
- If re-setup is truly required, delete the DB knowingly (data loss).
When it happens
Trigger: Calling the 'setup' socket event on an instance that already has an admin user. Happens if the frontend setup screen is force-shown, or a client replays setup after installation completed.
Common situations: Stale frontend state showing the setup page after setup finished; a second browser tab attempting setup; DB restored with existing users; scripted setup run twice.
Related errors
- passwordTooWeak
- Invalid new password
- Invalid Docker response, is it Docker really a daemon?
- domain_expiry_unsupported_monitor_type
- domain_expiry_unsupported_missing_target
AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12).
Data as JSON: /api/errors/5c62e607520a6a35.
Report an issue: GitHub.