Skip to content

Report [project] baml.toml table as [package] typo#3715

Draft
ATX24 wants to merge 1 commit into
canaryfrom
cursor/baml-toml-project-warning-ca18
Draft

Report [project] baml.toml table as [package] typo#3715
ATX24 wants to merge 1 commit into
canaryfrom
cursor/baml-toml-project-warning-ca18

Conversation

@ATX24

@ATX24 ATX24 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

The error

A baml.toml copied with a Python-style [project] table is not a valid BAML manifest:

[project]
name = "test"
version = "0.1.0"

Before this change, running:

baml describe String

failed with a generic manifest error like:

error: .../baml.toml: missing `[package]` table.

That message did not mention that [project] was present, so the user/agent had no direct hint that the intended BAML table is [package].

Root cause

baml_language/crates/baml_cli/src/project_load.rs::validate_baml_toml only looked up table.get("package") and emitted the generic missing-table diagnostic when it was absent. It did not inspect the parsed TOML for a top-level [project] table before producing that fallback.

The read-only/introspection path, load_project_or_default, intentionally skips most manifest validation for commands like baml describe, so it also needed a narrow check for this known typo to avoid silently loading a project with a broken manifest header.

Separately, baml_language/crates/baml_cli/src/agent_command.rs::normalize_direct_skill_references normalized skill names from the external BAML skill archive but did not correct a bad baml.toml template if one contains [project].

The fix

  • Added a shared [project]-without-[package] diagnostic helper in project_load.rs:

    `[project]` is not a recognized table in baml.toml; did you mean `[package]`?
    
  • Used that helper in strict manifest validation so run/test/generate/pack get the targeted error instead of the generic missing [package] message.

  • Added the same narrow typo check to load_project_or_default, preserving general describe leniency while still surfacing this actionable manifest mistake.

  • Added context-aware skill content normalization so an installed BAML skill template that mentions baml.toml rewrites [project] to [package] without changing unrelated TOML snippets like pyproject.toml.

  • Added unit and e2e coverage for the strict loader, the introspection loader, the skill normalization, and the CLI describe reproduction.

Verification

Focused regressions:

cd baml_language
cargo fmt
cargo test -p baml_cli project_table

Output:

running 2 tests
test project_load::tests::rejects_project_table_with_package_hint ... ok
test project_load::tests::walk_up_reports_project_table_typo ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 211 filtered out; finished in 0.00s
cargo test -p baml_cli skill_baml_toml_template_uses_package_table

Output:

test agent_command::tests::skill_baml_toml_template_uses_package_table ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 212 filtered out; finished in 0.00s
cargo test -p baml_cli --test exit_code_e2e describe_with_project_table_reports_package_hint

Output:

test describe_with_project_table_reports_package_hint ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 23 filtered out; finished in 0.30s

Required Rust library tests:

RUSTFLAGS="-L native=/usr/lib/x86_64-linux-gnu -l node" cargo test --lib

Output ended with all library test binaries passing, including:

test result: ok. 55 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Full workspace suite (using the repository's configured nextest setup scripts for SDK fixtures):

cargo nextest run

Output:

Summary [1367.433s] 5635 tests run: 5635 passed (2 slow), 40 skipped

Manual reproduction after the change:

tmp=$(mktemp -d /tmp/baml-project-header.XXXXXX)
printf '[project]\nname = "test"\nversion = "0.1.0"\n' > "$tmp/baml.toml"
BAML_CLI_ALLOW_DIRECT=1 ./target/debug/baml-cli describe String --from "$tmp"

Output:

error: /tmp/baml-project-header.f2BM1Y/baml.toml: `[project]` is not a recognized table in baml.toml; did you mean `[package]`?

exit=4

Issue Reference

  • This PR fixes/closes #[issue number]

Changes

See The fix above.

Testing

  • Unit tests added/updated
  • Manual testing performed
  • Tested in Linux/Cursor Cloud

Screenshots

Not applicable.

PR Checklist

  • I have read and followed the contributing guidelines
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Additional Notes

All source changes are scoped to baml_language/. The legacy engine/ directory was not modified.

Open in Web Open in Cursor 

@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
beps Ready Ready Preview, Comment Jun 8, 2026 7:11pm
promptfiddle2 Ready Ready Preview, Comment Jun 8, 2026 7:11pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
promptfiddle Skipped Skipped Jun 8, 2026 7:11pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 15acfa85-a6f2-4c59-9e19-2b9163b237fc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/baml-toml-project-warning-ca18

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

⏭️ Performance benchmarks were skipped

Perf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to canary/main.

To run them on this PR, do any of the following, then push a commit (or re-run CI):

  • Add RUN_CODSPEED=1 to the PR description, or
  • Include run-perf or /perf in the PR title or any commit message.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

No description provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants