tracel-ai/burn · error
Name is not set
Error message
Name is not set
What it means
SqliteDatasetStorage::db_file resolves the database path; when no explicit db_file was provided it derives the filename from the dataset's name, and panics with 'Name is not set' if name is also None. The library cannot determine which database to open without at least one identifier.
Source
Thrown at crates/burn-dataset/src/dataset/sqlite.rs:420
/// Checks if the database file exists in the given path.
///
/// # Returns
///
/// * A boolean value indicating whether the file exists or not.
pub fn exists(&self) -> bool {
self.db_file().exists()
}
/// Fetches the database file path.
///
/// # Returns
///
/// * A `PathBuf` instance representing the file path.
pub fn db_file(&self) -> PathBuf {
match &self.db_file {
Some(db_file) => db_file.clone(),
None => {
let name = sanitize(self.name.as_ref().expect("Name is not set"));
Self::base_dir(self.base_dir.to_owned()).join(format!("{name}.db"))
}
}
}
/// Determines the base directory for storing the dataset.
///
/// # Arguments
///
/// * `base_dir` - An `Option` that may contain a `PathBuf` instance representing the base directory.
///
/// # Returns
///
/// * A `PathBuf` instance representing the base directory.
pub fn base_dir(base_dir: Option<PathBuf>) -> PathBuf {
match base_dir {
Some(base_dir) => base_dir,
None => dirs::cache_dir()View on GitHub (pinned to d16f7ba2ed)
Solutions
- Provide a name via SqliteDatasetStorage::create(Some("dataset-name")) or the builder's with_name.
- Alternatively specify an explicit db_file path so the name is never consulted.
- Check where the storage struct is constructed to ensure one of name/db_file is always set.
Example fix
// before
let storage = SqliteDatasetStorage::create(None);
let path = storage.db_file();
// after
let storage = SqliteDatasetStorage::create(Some("train"));
let path = storage.db_file(); Defensive patterns
Strategy: validation
Validate before calling
assert!(name.is_some() || db_file.is_some(), "SqliteDatasetStorage requires a name or explicit db_file");
Type guard
fn is_openable(s: &SqliteDatasetStorage) -> bool { /* true if name or db_file set */ true } Prevention
- Always pass Some(name) when constructing SqliteDatasetStorage
- Or provide an explicit db_file path
- Add a constructor helper that enforces at least one identifier is set
When it happens
Trigger: Calling db_file() (directly or via dataset opening helpers) on a SqliteDatasetStorage built as SqliteDatasetStorage::create(None) or otherwise with both db_file and name unset.
Common situations: Programmatic construction where the name argument was accidentally passed as None; config deserialization that dropped the name field; copying construction code but omitting the dataset name.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- The database file does not exist
- window size must be non-zero
- capture tensor operations must run inside CaptureDevice::cap
- Index out of bounds for InMemDataset: {index} >= {}
- Index out of bounds for ComposedDataset: {index} >= {}
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/475f5246d76bc3e1.
Report an issue: GitHub.