theonedev/onedev · error · ExplicitException

Server not set up yet

Error message

Server not set up yet

What it means

The reset-admin-password command handler loads the root (admin) user by User.ROOT_ID and resets its password. If the root user record does not exist, the database has not been initialized/populated (setup never ran), so it throws 'Server not set up yet'.

Source

Thrown at server-core/src/main/java/io/onedev/server/commandhandler/ResetAdminPassword.java:71

			System.exit(1);
		}

		try {
			doMaintenance(() -> {
				sessionFactoryService.start();

				try (var conn = dataService.openConnection()) {
					callWithTransaction(conn, () -> {
						dataService.checkDataVersion(conn, false);
						return null;
					});
				} catch (SQLException e) {
					throw new RuntimeException(e);
				}

				User root = userService.get(User.ROOT_ID);
				if (root == null)
					throw new ExplicitException("Server not set up yet");
				String password = Bootstrap.command.getArgs()[0];
				root.setTwoFactorAuthentication(null);
				root.setPassword(passwordService.encryptPassword(password));
				userService.update(root, null);

				// wait for a short period to have embedded db flushing data
				try {
					Thread.sleep(1000);
				} catch (InterruptedException e) {
					throw new RuntimeException(e);
				}

				logger.info("Password of user '" + root.getName() + "' has been reset");
				return null;
			});
			System.exit(0);
		} catch (ExplicitException e) {
			logger.error(e.getMessage());

View on GitHub (pinned to d44925c47c)

Solutions

  1. Ensure the server has completed initial setup (root user created) before running the command.
  2. Point the command at the correct site directory / database containing existing data.
  3. If the database was restored incompletely, restore the users table or re-run setup.
  4. Check that the server process is stopped or compatible with the command's direct DB access requirements.
Defensive patterns

Strategy: try-catch

Validate before calling

// verify root user exists before resetting password
User root = userService.get(User.ROOT_ID);
if (root == null)
    throw new IllegalStateException("Root user missing: complete setup first");

Try / catch

try {
    new ResetAdminPassword(...).start();
} catch (ExplicitException e) {
    if (e.getMessage().contains("Server not set up yet"))
    logger.error("Database has no admin user; run initial setup first");
}

Prevention

When it happens

Trigger: Running 'reset-admin-password <new-password>' against a OneDev database where the root user row is absent — i.e. before first-time setup completed or against a fresh/empty database.

Common situations: Pointing the command at the wrong data directory or wrong database; running it immediately after a fresh install before the setup wizard created the admin account; database restore that lacks the root user row.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/2d0da3d7bf41c338. Report an issue: GitHub.