BoundaryML/baml · error

artifact `{name}` (kind = "pack") sets `{field}`, which is i

Error message

artifact `{name}` (kind = "pack") sets `{field}`, which is ignored for pack artifacts — configure the build via [artifacts.{name}.pack] instead

What it means

The tools_size_gate config loader rejects a Cargo artifact of kind "pack" that sets build-related fields (package, target, no_default_features, features) which pack artifacts ignore. The error tells you to configure the build under [artifacts.<name>.pack] instead, surfacing the misconfiguration at load time rather than mid-build.

Source

Thrown at baml_language/crates/tools_size_gate/src/config.rs:263

        Ok(config)
    }

    /// Reject configurations the build path would silently ignore.
    fn validate(&self) -> Result<()> {
        for (name, artifact) in &self.artifacts {
            if artifact.kind == ArtifactKind::Pack {
                // `pack` builds the CLI + host from its [pack] table on the
                // host target; the generic cargo build flags don't apply and
                // would be silently ignored, so reject them up front rather
                // than measure an artifact that diverges from the config.
                let ignored = [
                    ("package", artifact.package.is_some()),
                    ("target", artifact.target.is_some()),
                    ("no_default_features", artifact.no_default_features),
                    ("features", !artifact.features.is_empty()),
                ];
                if let Some((field, _)) = ignored.iter().find(|(_, set)| *set) {
                    anyhow::bail!(
                        "artifact `{name}` (kind = \"pack\") sets `{field}`, which is ignored \
                         for pack artifacts — configure the build via [artifacts.{name}.pack] \
                         instead"
                    );
                }
                // Surface a missing [pack] table at load time, not mid-build.
                artifact
                    .pack
                    .as_ref()
                    .with_context(|| format!("artifact `{name}` (kind = \"pack\") is missing a [artifacts.{name}.pack] table"))?;
            }
        }
        Ok(())
    }

    /// Return the resolved platform for a given artifact config.
    /// WASM artifacts use their explicit target; native artifacts use the host triple.
    pub(crate) fn platform_for_artifact(artifact: &ArtifactConfig) -> String {

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Move the build settings into the [artifacts.<name>.pack] table and delete them from the artifact entry itself
  2. If the fields were meant to configure a build, change the artifact kind back to the appropriate build kind
  3. Remove the ignored fields entirely if the pack defaults are sufficient

Example fix

// before
[[artifacts]]
name = "cli"
kind = "pack"
features = ["big"]
// after
[[artifacts]]
name = "cli"
kind = "pack"
[artifacts.cli.pack]
features = ["big"]
Defensive patterns

Strategy: validation

Validate before calling

fn validate_pack_artifact(a: &Artifact) -> Result<(), String> {
    if a.kind == "pack" && (a.package.is_some() || a.target.is_some() || a.no_default_features || !a.features.is_empty()) {
        return Err(format!("artifact `{}` mixes pack kind with build fields; move them under [artifacts.{}.pack]", a.name, a.name));
    }
    Ok(())
}

Type guard

fn is_pack_with_build_fields(a: &Artifact) -> bool {
    a.kind == "pack" && (a.package.is_some() || a.target.is_some() || a.no_default_features || !a.features.is_empty())
}

Try / catch

match tools_size_gate::config::load(&path) {
    Err(e) if e.to_string().contains("ignored for pack artifacts") => eprintln!("move build settings into [artifacts.<name>.pack]: {e}"),
    Err(e) => return Err(e),
    Ok(cfg) => cfg,
}

Prevention

When it happens

Trigger: Running size gate load/validation with a config where a [[artifacts]] entry has kind = "pack" and any of package/target/no_default_features/features set; validate() bails immediately.

Common situations: Copying an artifact entry from a non-pack kind and only changing kind to "pack"; merging configs where build fields linger after switching the artifact kind.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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