{"record":{"id":"9e690ca1fd994806","repo":"windmill-labs/windmill","slug":"could-not-parse-embedded-manifest","errorCode":null,"errorMessage":"Could not parse embedded manifest: {}","messagePattern":"Could not parse embedded manifest: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-rust/src/lib.rs","lineNumber":157,"sourceCode":"            let typ = parse_pat_type(s.ty.clone());\n            (otyp, typ, name)\n        }\n    }\n}\n\n#[derive(Debug, PartialEq)]\nenum Manifest {\n    Toml(String),\n    DepList(String),\n}\n\nimpl Manifest {\n    pub fn into_toml(self) -> anyhow::Result<toml::value::Table> {\n        match self {\n            Manifest::Toml(s) => toml::from_str(&s),\n            Manifest::DepList(s) => Manifest::dep_list_to_toml(&s),\n        }\n        .map_err(|e| anyhow!(\"Could not parse embedded manifest: {}\", e))\n    }\n\n    fn dep_list_to_toml(s: &str) -> ::std::result::Result<toml::value::Table, toml::de::Error> {\n        let mut r = String::new();\n        r.push_str(\"[dependencies]\\n\");\n        for dep in s.trim().split(',') {\n            // If there's no version specified, add one.\n            match dep.contains('=') {\n                true => {\n                    r.push_str(dep);\n                    r.push('\\n');\n                }\n                false => {\n                    r.push_str(dep);\n                    r.push_str(\"=\\\"*\\\"\\n\");\n                }\n            }\n        }","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-rust/src/lib.rs#L139-L175","documentation":"Windmill's Rust script parser (`windmill-parser-rust`) reads an embedded Cargo manifest from the script source — either a `// cargo-deps:` comment line (DepList) or a ```Cargo.toml``` code block (Toml) — and converts it into a TOML table. `into_toml` wraps any TOML deserialization failure of that embedded manifest with this message. It is thrown at script-parse time, before the script ever runs.","triggerScenarios":"Called via `into_toml` when: (1) a `// cargo-deps:` line contains entries that produce invalid TOML after dep_list_to_toml rewrites them (e.g. an entry with stray characters, a trailing comma producing an empty entry like `foo=\"*\"` is fine but `=` with empty key/value is not), or (2) a ```Cargo.toml fenced block in the script is not valid TOML (missing brackets around `[dependencies]`, wrong indentation producing bare values, unclosed strings).","commonSituations":"Hand-editing the cargo-deps line and leaving a trailing comma or a `dep=` entry with an empty version; copying a Cargo.toml block that includes non-TOML prose or markdown; Windows line endings combined with inline comments confusing the shorthand parser; using crate features syntax `serde={version=\"1\",features=[\"derive\"]}` on a single comment line where the parser expects `name=version` only.","solutions":["Read the inner TOML error after the colon in the message; it names the offending line/entry of the embedded manifest.","If using the `// cargo-deps:` shorthand, make it a comma-separated list of `crate=version` (version optional): `// cargo-deps: serde=1.0 reqwest` — no braces, no features syntax.","If using a ```Cargo.toml code block, validate it as standalone TOML (e.g. paste into a TOML linter) with a proper `[dependencies]` section.","Remove the embedded manifest entirely to fall back to the default manifest if dependencies aren't needed."],"exampleFix":"// before — invalid: braces/features not supported in the shorthand line\n// cargo-deps: serde={version=\"1\", features=[\"derive\"]},\n\n// after\n// cargo-deps: serde=1.0\n// (or move features into a ```Cargo.toml code block)","handlingStrategy":"validation","validationCode":"// Rust: validate the embedded manifest before handing the script to the parser\nfn valid_embedded_manifest(src: &str) -> bool {\n    if let Some(line) = src.lines().find(|l| l.trim().to_lowercase().starts_with(\"//cargo-deps:\")) {\n        return line.split(':').nth(1).map_or(false, |deps| {\n            deps.split(',').all(|d| {\n                let d = d.trim();\n                d.is_empty() || d.split('=').count() <= 2 && !d.starts_with('=')\n            })\n        });\n    }\n    true // no embedded manifest -> default used\n}","typeGuard":null,"tryCatchPattern":"// Rust\nmatch parse_rust_sig(&code) {\n    Ok(sig) => /* use sig */,\n    Err(e) if e.to_string().contains(\"Could not parse embedded manifest\") => {\n        eprintln!(\"Fix the // cargo-deps: line or ```Cargo.toml block: {e}\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep the `// cargo-deps:` line a simple comma-separated `crate=version` list; use a ```Cargo.toml block when you need features or tables.","Never leave trailing commas or empty `dep=` entries in the dep list.","Lint the embedded manifest as standalone TOML in CI before deploying the script.","Prefer `wmill script` CLI validation locally before pushing."],"tags":["rust","toml","manifest","parsing","windmill-scripts"],"backgroundTag":"embedded-manifest-parse-failed","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}