theonedev/onedev · critical · RuntimeException

Unrecognized command:

Error message

Unrecognized command: 

What it means

During bootstrap, OneDev's Guice module selects a plugin/application class based on the CLI command that started the server. If Bootstrap.command is set to a command name the module does not recognize, it throws this RuntimeException and startup aborts.

Source

Thrown at server-core/src/main/java/io/onedev/server/CoreModule.java:954

				return RestoreDatabase.class;
			else if (ApplyDatabaseConstraints.COMMAND.equals(Bootstrap.command.getName()))
				return ApplyDatabaseConstraints.class;
			else if (BackupDatabase.COMMAND.equals(Bootstrap.command.getName()))
				return BackupDatabase.class;
			else if (CheckDataVersion.COMMAND.equals(Bootstrap.command.getName()))
				return CheckDataVersion.class;
			else if (Upgrade.COMMAND.equals(Bootstrap.command.getName()))
				return Upgrade.class;
			else if (CleanDatabase.COMMAND.equals(Bootstrap.command.getName()))
				return CleanDatabase.class;
			else if (ResetAdminPassword.COMMAND.equals(Bootstrap.command.getName()))
				return ResetAdminPassword.class;
			else if (EnableInternalLogin.COMMAND.equals(Bootstrap.command.getName()))
				return EnableInternalLogin.class;
			else if (Translate.COMMAND.equals(Bootstrap.command.getName()))
				return Translate.class;
			else
				throw new RuntimeException("Unrecognized command: " + Bootstrap.command.getName());
		} else {
			return OneDev.class;
		}		
	}

}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Check the exact command name passed via the bootstrap.command property and correct the spelling/case to a supported command (ResetAdminPassword, EnableInternalLogin, Translate) or remove the property entirely to start the normal server.
  2. Verify the OneDev version: if you rely on a command added in a newer release, upgrade the jar so CoreModule recognizes it.
  3. Run without any command property so the else branch returns the normal OneDev application class.
  4. If you intentionally added a custom command, register it in CoreModule.getPluginClass's if/else chain.

Example fix

// before
java -jar onedev.jar --bootstrap.command=restAdminPassword
// after
java -jar onedev.jar --bootstrap.command=resetAdminPassword
Defensive patterns

Strategy: validation

Validate before calling

String cmd = System.getProperty("bootstrap.command");
Set<String> supported = Set.of("resetAdminPassword","enableInternalLogin","translate");
if (cmd != null && !supported.contains(cmd))
    throw new IllegalArgumentException("Unsupported bootstrap command: " + cmd);

Try / catch

try {
    startServer(args);
} catch (RuntimeException e) {
    if (e.getMessage().startsWith("Unrecognized command:")) {
        System.err.println("Fix --bootstrap.command value or omit it; supported: resetAdminPassword, enableInternalLogin, translate");
    }
}

Prevention

When it happens

Trigger: Starting OneDev with a -Dbootstrap.command (or equivalent) value that is not resetAdminPassword, enableInternalLogin, or translate, so getPluginClass falls through the else branch and throws.

Common situations: Typo in the command name, running a stripped/older build where the command class was removed, launching the jar with a leftover bootstrap.command property from a previous invocation, or scripting tools that pass an unexpected command.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


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