databendlabs/databend · error
no data found
Error message
no data found
What it means
validate_version reads the first line of a streamed data dump (meta backup/upgrade payload) via lines.peek(); if the iterator is empty — no data at all — it returns "no data found". It guards against being handed an empty file or stream where a version header is mandatory.
Solutions
- Check the dump file exists and is non-empty (ls -l / wc -c) before running the restore/upgrade
- Re-create the backup/export; the source produced no data
- Verify you are pointing the tool at the correct input file, not a placeholder path
- If streaming, confirm the upstream writer actually flushed and closed successfully
Example fix
// before
let f = File::open(&path)?;
validate_version(BufReader::new(f).lines().peekable())?;
// after
let meta = std::fs::metadata(&path)?;
anyhow::ensure!(meta.len() > 0, "dump file {} is empty", path.display());
let f = File::open(&path)?; Defensive patterns
Strategy: validation
Validate before calling
let md = std::fs::metadata(&dump_path)?;
anyhow::ensure!(md.len() > 0, "dump {} is empty", dump_path.display()); Type guard
fn has_first_line<R: BufRead>(r: &mut Peekable<Lines<R>>) -> bool { r.peek().is_some() } Try / catch
match validate_version(&mut lines) {
Err(e) if e.to_string() == "no data found" => bail!("dump file is empty; regenerate the backup"),
other => other?,
} Prevention
- Check file size after every backup/export
- Verify the pipeline step that produced the dump exited 0
- Point tooling at real files, never placeholder paths
When it happens
Trigger: Calling validate_version with an empty reader: zero lines remain in the Peekable<Lines<B>>, so peek() returns None.
Common situations: Restoring a meta data backup from a truncated or empty file; piping an empty stdin to the meta upgrade tool; a failed export produced a 0-byte dump.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- invalid data version
- Unsupported format for
- Unsupported source type. Expected path, pandas.DataFrame…
- Access denied: is outside allowed directories
- rename_database: src (db) should exist
AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11).
Data as JSON: /api/errors/95a59acfd687e44a.
Report an issue: GitHub.
Appendix: source
Thrown at src/meta/control/src/reading.rs:33
//! Supporting utilities for reading exported data.
use std::io::BufRead;
use std::io::Lines;
use std::iter::Peekable;
use databend_meta::raft_config::data_version::DATA_VERSION;
use databend_meta::raft_config::data_version::DataVersion;
use databend_meta::store_compat::ondisk::TREE_HEADER;
use databend_meta::store_compat::sled_compat::key_spaces::RaftStoreEntry;
/// Import from lines of exported data and Return the max log id that is found.
pub fn validate_version<B: BufRead + 'static>(
lines: &mut Peekable<Lines<B>>,
) -> anyhow::Result<DataVersion> {
#[allow(clippy::useless_conversion)]
let first = lines
.peek()
.ok_or_else(|| anyhow::anyhow!("no data found"))?;
let first_line = match first {
Ok(l) => l,
Err(e) => {
return Err(anyhow::anyhow!("{}", e));
}
};
// First line is the data header that containing version.
let version = read_version(first_line)?;
if !DATA_VERSION.is_compatible(version) {
return Err(anyhow::anyhow!(
"invalid data version: {:?}, This program version is {:?}; The latest compatible program version is: {:?}",
version,
DATA_VERSION,
version.max_compatible_working_version(),
));View on GitHub (pinned to 288d84d76e)