windmill-labs/windmill · critical
Failed to parse Cargo.toml.default
Error message
Failed to parse Cargo.toml.default
What it means
default_manifest loads the vendored manifest/Cargo.toml.default (embedded via include_str!) and parses it into a TOML table to build the base manifest for Rust script dependency resolution. The .expect panics if the embedded default file is not valid TOML — this indicates a broken build artifact/shipped crate rather than user input, since the file is compiled into the binary.
Source
Thrown at backend/parsers/windmill-parser-rust/src/lib.rs:183
match dep.contains('=') {
true => {
r.push_str(dep);
r.push('\n');
}
false => {
r.push_str(dep);
r.push_str("=\"*\"\n");
}
}
}
toml::from_str(&r)
}
}
fn default_manifest() -> toml::value::Table {
toml::from_str(include_str!("../manifest/Cargo.toml.default"))
.expect("Failed to parse Cargo.toml.default")
}
/**
* Get a `Manifest` that can be made into a TOML table. The format and logic are the same as in
* the rust-script or cargo-eval projects.
*/
fn find_embedded_manifest(s: &str) -> Option<Manifest> {
find_short_hand_manifest(s).or_else(|| find_code_block_manifest(s))
}
fn find_short_hand_manifest(s: &str) -> Option<Manifest> {
let re: Regex = Regex::new(r"^(?i)\s*//\s*cargo-deps\s*:(.*?)(\r\n|\n)").unwrap();
/*
This is pretty simple: the only valid syntax for this is for the first, non-blank line to contain a single-line comment whose first token is `cargo-deps:`. That's it.
*/
if let Some(cap) = re.captures(s) {
if let Some(m) = cap.get(1) {
return Some(Manifest::DepList(m.as_str().to_string()));View on GitHub (pinned to e474e8803c)
Solutions
- Validate the file: run `cargo metadata`-style check or any TOML linter on backend/parsers/windmill-parser-rust/manifest/Cargo.toml.default and fix syntax errors.
- Restore the file with `git checkout -- backend/parsers/windmill-parser-rust/manifest/Cargo.toml.default`.
- Rebuild cleanly (cargo clean) if a stale build artifact is suspected.
- In code, replace expect with a descriptive anyhow error if you want a non-panicking path.
Example fix
// before
toml::from_str(include_str!("../manifest/Cargo.toml.default"))
.expect("Failed to parse Cargo.toml.default")
// after
toml::from_str(include_str!("../manifest/Cargo.toml.default"))
.map_err(|e| anyhow!("Failed to parse Cargo.toml.default: {e}"))? Defensive patterns
Strategy: validation
Validate before calling
// Validate the embedded default manifest is well-formed TOML at build/startup time
let raw = include_str!("../manifest/Cargo.toml.default");
let _table: toml::value::Table = toml::from_str(raw)
.expect("bundled Cargo.toml.default is not valid TOML; restore the file"); Try / catch
// The call panics via expect; isolate if a broken artifact must not take the process down:
let manifest = std::panic::catch_unwind(default_manifest)
.map_err(|_| anyhow!("Failed to parse Cargo.toml.default; check the shipped manifest file"))?; Prevention
- Never hand-edit manifest/Cargo.toml.default; keep it under version control
- Add a unit test (test_default_manifest exists) to CI so TOML regressions fail early
- Restore the file with git checkout after bad merges
- Run cargo clean if build artifacts are suspected corrupted
When it happens
Trigger: parse_rust_deps_into_manifest calling default_manifest() when the bundled ../manifest/Cargo.toml.default cannot be deserialized by toml::from_str (e.g. corrupted or hand-edited manifest shipped in the crate).
Common situations: A modified/corrupted Cargo.toml.default in a source checkout or vendored dependency; a bad merge that left the TOML syntactically invalid; building from a partial/corrupted source tree.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Could not parse embedded manifest: {}
- unreachable, language is not supported: {language:#?}
- itered cannot be empty
- YAML emit error: {}
- hex string did not decode to an u64: {s}
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/c4a51118d5d8cfef.
Report an issue: GitHub.