theonedev/onedev · error · RuntimeException
Incorrect data format: no data version
Error message
Incorrect data format: no data version
What it means
migrateData locates the version element by looking up child element ModelVersion.PROP_VERSION_COLUMN under the single root child of the db_version XML file. If that element is missing, the file has no data version recorded and it throws this RuntimeException.
Source
Thrown at server-core/src/main/java/io/onedev/server/data/DefaultDataService.java:340
private File getVersionFile(File dataDir) {
File versionFile = new File(dataDir, ModelVersion.class.getSimpleName() + "s.xml");
if (!versionFile.exists())
versionFile = new File(dataDir, "VersionTables.xml");
return versionFile;
}
@Override
public void migrateData(File dataDir) {
File versionFile = getVersionFile(dataDir);
VersionedXmlDoc dom = VersionedXmlDoc.fromFile(versionFile);
List<Element> elements = dom.getRootElement().elements();
if (elements.size() != 1)
throw new RuntimeException("Incorrect data format: illegal data version");
Element versionElement = elements.iterator().next().element(ModelVersion.PROP_VERSION_COLUMN);
if (versionElement == null) {
throw new RuntimeException("Incorrect data format: no data version");
}
if (MigrationHelper.migrate(versionElement.getText(), new DataMigrator(), dataDir)) {
// load version file again in case we changed something of it while migrating
versionFile = getVersionFile(dataDir);
dom = VersionedXmlDoc.fromFile(versionFile);
elements = dom.getRootElement().elements();
Preconditions.checkState(elements.size() == 1);
versionElement = Preconditions.checkNotNull(elements.iterator().next().element(ModelVersion.PROP_VERSION_COLUMN));
versionElement.setText(MigrationHelper.getVersion(DataMigrator.class));
dom.writeToFile(versionFile, false);
}
}
/**
* Determines whether or not entityType1 has transitive foreign key
* dependency on entityType2.
* View on GitHub (pinned to d44925c47c)
Solutions
- Restore the db_version file from backup and ensure it contains a <version>N</version> entry
- Recreate the file with the proper structure: single child element containing the version column element
- If the site data version cannot be determined, re-initialize the data directory
- Check the file with the same OneDev version to confirm the expected structure
Example fix
<!-- before --> <root><other>10</other></root> <!-- after --> <root><version>10</version></root>
Defensive patterns
Strategy: validation
Validate before calling
Element versionEl = (Element) dom.getRootElement().elements().get(0).element("version");
if (versionEl == null) restoreFromBackup(dbVersionFile); Try / catch
try { migrateData(dir); } catch (RuntimeException e) { if (e.getMessage().contains("no data version")) { recreateDbVersionFile(); } } Prevention
- Preserve the <version> element when editing any versioned file
- Take backups of data-dir metadata files
- Never regenerate the version file by hand — copy from a working install
- Use OneDev's own export/import instead of manual file surgery
When it happens
Trigger: The db_version XML file exists with exactly one root child, but that child lacks the 'version' column element — e.g. the file was hand-edited or generated incorrectly.
Common situations: Manual editing/removal of the version entry in the site data directory, corrupted export, or copy-pasting a wrong file structure into db_version.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Incorrect data format: illegal data version
- Unable to upgrade specified installation as database is not
- Unable to upgrade specified installation due to above error
- Unable to upgrade specified installation as data version of
- OneDev program is too old, please use a newer version
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/a47e1f7cc2755867.
Report an issue: GitHub.