theonedev/onedev · error · AuthenticationException

Error authenticating user

Error message

Error authenticating user

What it means

Catch-all wrapper in doGetAuthenticationInfo: any non-AuthenticationException exception escaping the authentication logic is logged and rethrown as AuthenticationException('Error authenticating user') with the original as cause. It signals an unexpected internal problem (database, plugin authenticator crash, etc.), not failed credentials.

Source

Thrown at server-core/src/main/java/io/onedev/server/security/DefaultAuthenticatingService.java:204

									throw new AuthenticationException(MessageFormat.format(_T("Email address \"{0}\" already used by another account"), emailAddressValue));
								}
							} else {
								return newUser(userName, authenticated, authenticator.getDefaultGroup());
							}
						} else {
							return newUser(userName, authenticated, authenticator.getDefaultGroup());
						}
					} else {
						throw new UnknownAccountException(_T("Invalid credentials"));
					}
				}
			} catch (Exception e) {
				if (e instanceof AuthenticationException) {
					logger.debug("Authentication not passed", e);
					throw ExceptionUtils.unchecked(e);
				} else {
					logger.error("Error authenticating user", e);
					throw new AuthenticationException(_T("Error authenticating user"), e);
				}
			}
		});
	}

	public Object writeReplace() throws ObjectStreamException {
		return new ManagedSerializedForm(AuthenticatingService.class);
	}

}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Read the server log for the logged 'Error authenticating user' stack trace to find the root cause.
  2. If caused by an external authenticator, verify the directory/SSO server is reachable and its config is valid.
  3. Check database health/connectivity if the trace points to persistence calls.
  4. Update or fix the custom authenticator plugin; report a bug with the stack trace if it is core code.

Example fix

// before: authenticator.authenticate() throws NPE -> 'Error authenticating user'
// after: fix authenticator config (e.g. correct LDAP bind DN/base DN) so authenticate() succeeds
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight: verify DB reachable and external authenticator responds before login attempts
checkDatabaseAlive();
checkAuthenticatorEndpointReachable();

Type guard

function authInfrastructureHealthy(db, settings) { return db.alive && (settings.authenticator == null || settings.authenticator.reachable); }

Try / catch

try {
  authenticate(user, pass);
} catch (AuthenticationException e) {
  if (e.getMessage().equals("Error authenticating user") && e.getCause() != null) {
    inspectRootCause(e.getCause()); // server log has full stack trace
  }
}

Prevention

When it happens

Trigger: Any RuntimeException during login processing - e.g. the configured external authenticator throws a non-auth exception, DB connectivity issues while loading the user, NPE in email sync code.

Common situations: Misbehaving custom authenticator plugin; database unavailable or schema mismatch after upgrade; LDAP server errors surfacing as raw exceptions from the authenticator.

Understand the failure class

Related errors


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