{"record":{"id":"5716054214a3a7cc","repo":"BoundaryML/baml","slug":"artifact-name-kind-pack-sets-field-which-is-ignored-for-pack","errorCode":null,"errorMessage":"artifact `{name}` (kind = \"pack\") sets `{field}`, which is ignored for pack artifacts — configure the build via [artifacts.{name}.pack] instead","messagePattern":"artifact `(.+?)` \\(kind = \"pack\"\\) sets `(.+?)`, which is ignored for pack artifacts — configure the build via \\[artifacts\\.(.+?)\\.pack\\] instead","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/tools_size_gate/src/config.rs","lineNumber":263,"sourceCode":"        Ok(config)\n    }\n\n    /// Reject configurations the build path would silently ignore.\n    fn validate(&self) -> Result<()> {\n        for (name, artifact) in &self.artifacts {\n            if artifact.kind == ArtifactKind::Pack {\n                // `pack` builds the CLI + host from its [pack] table on the\n                // host target; the generic cargo build flags don't apply and\n                // would be silently ignored, so reject them up front rather\n                // than measure an artifact that diverges from the config.\n                let ignored = [\n                    (\"package\", artifact.package.is_some()),\n                    (\"target\", artifact.target.is_some()),\n                    (\"no_default_features\", artifact.no_default_features),\n                    (\"features\", !artifact.features.is_empty()),\n                ];\n                if let Some((field, _)) = ignored.iter().find(|(_, set)| *set) {\n                    anyhow::bail!(\n                        \"artifact `{name}` (kind = \\\"pack\\\") sets `{field}`, which is ignored \\\n                         for pack artifacts — configure the build via [artifacts.{name}.pack] \\\n                         instead\"\n                    );\n                }\n                // Surface a missing [pack] table at load time, not mid-build.\n                artifact\n                    .pack\n                    .as_ref()\n                    .with_context(|| format!(\"artifact `{name}` (kind = \\\"pack\\\") is missing a [artifacts.{name}.pack] table\"))?;\n            }\n        }\n        Ok(())\n    }\n\n    /// Return the resolved platform for a given artifact config.\n    /// WASM artifacts use their explicit target; native artifacts use the host triple.\n    pub(crate) fn platform_for_artifact(artifact: &ArtifactConfig) -> String {","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/tools_size_gate/src/config.rs#L245-L281","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Move the build settings into the [artifacts.<name>.pack] table and delete them from the artifact entry itself","If the fields were meant to configure a build, change the artifact kind back to the appropriate build kind","Remove the ignored fields entirely if the pack defaults are sufficient"],"exampleFix":"// before\n[[artifacts]]\nname = \"cli\"\nkind = \"pack\"\nfeatures = [\"big\"]\n// after\n[[artifacts]]\nname = \"cli\"\nkind = \"pack\"\n[artifacts.cli.pack]\nfeatures = [\"big\"]","handlingStrategy":"validation","validationCode":"fn validate_pack_artifact(a: &Artifact) -> Result<(), String> {\n    if a.kind == \"pack\" && (a.package.is_some() || a.target.is_some() || a.no_default_features || !a.features.is_empty()) {\n        return Err(format!(\"artifact `{}` mixes pack kind with build fields; move them under [artifacts.{}.pack]\", a.name, a.name));\n    }\n    Ok(())\n}","typeGuard":"fn is_pack_with_build_fields(a: &Artifact) -> bool {\n    a.kind == \"pack\" && (a.package.is_some() || a.target.is_some() || a.no_default_features || !a.features.is_empty())\n}","tryCatchPattern":"match tools_size_gate::config::load(&path) {\n    Err(e) if e.to_string().contains(\"ignored for pack artifacts\") => eprintln!(\"move build settings into [artifacts.<name>.pack]: {e}\"),\n    Err(e) => return Err(e),\n    Ok(cfg) => cfg,\n}","preventionTips":["When changing an artifact kind, delete now-irrelevant build fields","Use the [artifacts.<name>.pack] table for all pack build settings","Run config load in CI to catch misconfigs before builds"],"tags":["config","cargo-artifacts","size-gate","validation"],"backgroundTag":"conflicting-config-options","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}