BoundaryML/baml · error · ManifestError

{path}: `[package].name` cannot be empty.

Error message

{path}: `[package].name` cannot be empty.

What it means

Manifest validation error: the baml.toml at {path} has a [package] table with a name key whose value is the empty string. The package name is required to identify the project, and an empty name would break generated identifiers and manifest lookups downstream, so parsing rejects it at load time.

Source

Thrown at baml_language/crates/baml_db/src/manifest.rs:189

    #[serde(flatten)]
    pub unknown: IndexMap<String, toml::Value>,
}

/// Parse `baml.toml` text into the typed manifest.
pub fn parse(content: &str) -> Result<BamlToml, toml::de::Error> {
    toml::from_str(content)
}

/// Why a manifest's `[package].name` could not be resolved.
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
pub enum ManifestError {
    #[error(
        "{path}: missing `[package]` table.\nAdd:\n\n    [package]\n    name = \"<your-project-name>\"\n"
    )]
    MissingPackageTable { path: std::path::PathBuf },
    #[error("{path}: `[package]` is missing `name = \"<your-project-name>\"`.")]
    MissingPackageName { path: std::path::PathBuf },
    #[error("{path}: `[package].name` cannot be empty.")]
    EmptyPackageName { path: std::path::PathBuf },
    #[error(
        "{path}: `[dependencies]` is not supported in a project manifest yet: package imports are \
         pending a design pass. Remove the table; a project reaches the standard library implicitly."
    )]
    DependenciesUnsupported { path: std::path::PathBuf },
    #[error(
        "{path}: `[package].prelude` is reserved for the standard library's own manifests. Remove it."
    )]
    PreludeUnsupported { path: std::path::PathBuf },
}

/// Refuse the manifest tables only the standard library's own manifests may
/// carry. Package imports are not user surface area until they get a design
/// pass, so a project manifest with `[dependencies]` (or the stdlib-only
/// `[package].prelude`) is an error, not a silently ignored table.
pub fn reject_stdlib_only_tables(
    manifest: &BamlToml,

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Set `name` to a non-empty project name in the `[package]` table.
  2. If the name comes from a variable/template, check the variable is populated.
  3. Validate the manifest before committing it.

Example fix

// before
[package]
name = ""
// after
[package]
name = "my-project"
Defensive patterns

Strategy: validation

Validate before calling

fn name_nonempty(raw: &str) -> bool {
    raw.parse::<toml::Value>().ok()
        .and_then(|v| v.get("package")?.get("name")?.as_str().map(|s| !s.is_empty()))
        .unwrap_or(false)
}

Try / catch

match load_manifest(path) {
    Err(ManifestError::EmptyPackageName { path }) => eprintln!("{path:?}: [package].name cannot be empty"),
    Err(e) => eprintln!("manifest error: {e}"),
    Ok(m) => m,
}

Prevention

When it happens

Trigger: Loading a manifest containing `[package]\nname = ""` — typically from templated generation where a placeholder was never filled in.

Common situations: Unfilled template placeholders; scripted manifest generation writing an empty value; clearing the name during renaming and forgetting to set a new one.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/b9f9f9604cc74703. Report an issue: GitHub.