theonedev/onedev · error · ExplicitException

Database is not populated yet

Error message

Database is not populated yet

What it means

checkDataVersion reads the data version recorded in the database. If the database contains no version row and empty databases are not allowed, OneDev concludes the schema has never been populated and throws this ExplicitException to stop startup/migration against an empty DB.

Source

Thrown at server-core/src/main/java/io/onedev/server/data/DefaultDataService.java:233

					if (sql.contains(" drop ") && e.getMessage() != null)
						logger.warn(e.getMessage());
					else
						logger.error("Error executing sql: " + sql, e);
					if (failOnError) 
						throw e;
				}
			}
		} catch (SQLException e) {
			throw new RuntimeException(e);
		}
	}
	
	@Override
	public String checkDataVersion(Connection conn, boolean allowEmptyDB) {
		String dbDataVersion = readDbDataVersion(conn);
		
		if (!allowEmptyDB && dbDataVersion == null) 
			throw new ExplicitException("Database is not populated yet");
		String appDataVersion = MigrationHelper.getVersion(DataMigrator.class);
		if (dbDataVersion != null && !dbDataVersion.equals(appDataVersion)) {
			throw new ExplicitException(String.format("Data version mismatch (app data version: %s, db data version: %s)", 
					appDataVersion, dbDataVersion));
		}
		return dbDataVersion;
	}
	
	@Override
	public void populateDatabase(Connection conn) {
		if (hibernateConfig.isHSQLDialect()) 
			execute(conn, Lists.newArrayList("SET DATABASE TRANSACTION CONTROL MVCC"), true);
		
		String dbDataVersion = checkDataVersion(conn, true);
		
		if (dbDataVersion == null) {
			File tempFile = null;
        	try {

View on GitHub (pinned to d44925c47c)

Solutions

  1. Let OneDev initialize the database itself on first startup (no manual pre-creation needed against an empty DB)
  2. Verify the JDBC URL/credentials point at the actual OneDev database, not an empty one
  3. Re-run the restore/upgrade procedure if a previous restore left the DB empty
  4. Drop and recreate the DB and start OneDev fresh if data is not needed

Example fix

// before
jdbcUrl=jdbc:h2:/var/lib/onedev/database/wrong_empty_db
// after
jdbcUrl=jdbc:h2:/var/lib/onedev/database/onedev
Defensive patterns

Strategy: validation

Validate before calling

// check DB is populated before pointing OneDev at it
boolean populated = tableExists(conn, "model_version") && hasRows(conn, "model_version");

Try / catch

try { startServer(); } catch (ExplicitException e) { if (e.getMessage().equals("Database is not populated yet")) { verifyJdbcUrl(); letOneDevInitialize(); } }

Prevention

When it happens

Trigger: dbDataVersion calls checkDataVersion(conn, allowEmptyDB=false) against a freshly created, empty database (the ModelVersion table is missing or has no rows).

Common situations: Pointing OneDev at a brand-new empty database instead of letting it initialize; a restore that created the schema but inserted no version row; wrong JDBC URL pointing to an empty DB instance.

Related errors


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