{"record":{"id":"9ee5cd269d58c1d1","repo":"windmill-labs/windmill","slug":"section-dependency-element-missing-or-invalid","errorCode":null,"errorMessage":"{section} dependency element: missing or invalid `name` field","messagePattern":"(.+?) dependency element: missing or invalid `name` field","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-yaml/src/lib.rs","lineNumber":904,"sourceCode":"        for el in elements {\n            let Yaml::Hash(ref mut h) = el else {\n                return Err(anyhow!(\"{section} dependency element should be a map\"));\n            };\n\n            if let Some(name) = h\n                .get(&Yaml::String(\"name\".to_string()))\n                .and_then(|n| n.as_str())\n            {\n                if let Some(version) = versions.get(name) {\n                    h.insert(\n                        Yaml::String(\"version\".to_string()),\n                        Yaml::String(version.to_string()),\n                    );\n                } else {\n                    logs.push_str(&format!(\"WARNING: {section} dependency `{name}` has no locked version, using the latest or system installed version.\\n\"));\n                }\n            } else {\n                return Err(anyhow!(\n                    \"{section} dependency element: missing or invalid `name` field\"\n                ));\n            }\n        }\n    }\n\n    Ok(logs)\n}\n\npub fn add_versions_to_requirements_yaml(\n    input: &str,\n    role_versions: &HashMap<String, String>,\n    collection_versions: &HashMap<String, String>,\n) -> anyhow::Result<(String, String)> {\n    let mut docs =\n        YamlLoader::load_from_str(input).map_err(|e| anyhow!(\"YAML parse error: {}\", e))?;\n    let doc = &mut docs[0];\n","sourceCodeStart":886,"sourceCodeEnd":922,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-yaml/src/lib.rs#L886-L922","documentation":"Each roles/collections entry in the requirements YAML must have a `name` field that is a string. update_versions throws this when the entry is a map but lacks `name`, or its `name` value is not a plain string (e.g. an integer, boolean, or nested structure), because the name is required to look up the locked version.","triggerScenarios":"An entry like `- version: 1.2.3` (version without name), `- src: ...` only, or `- name: 123` where the name is numeric and YAML infers a non-string type.","commonSituations":"Using the `src` key (legacy git-role format) instead of `name`; copy-pasting collection entries that only carry `version`; numeric-looking collection names (e.g. org names starting with digits) parsed as integers; forgetting the name when hand-editing.","solutions":["Add a `name:` key to every entry: `- name: community.postgresql`.","Quote the name if it could parse as a number or boolean: `name: \"123org.collection\"`.","Rename legacy `src:` keys to `name:` or restructure for this parser.","Ensure the name value is a scalar string, not a nested map/list."],"exampleFix":"# before\ncollections:\n  - version: 3.0.0\n# after\ncollections:\n  - name: community.postgresql\n    version: 3.0.0","handlingStrategy":"validation","validationCode":"fn validate_names(input: &str) -> Result<(), String> {\n    let doc: serde_yaml::Value = serde_yaml::from_str(input).map_err(|e| e.to_string())?;\n    for section in [\"roles\", \"collections\"] {\n        if let Some(items) = doc.get(section).and_then(|s| s.as_sequence()) {\n            for (i, e) in items.iter().enumerate() {\n                match e.get(\"name\").map(|n| n.is_string()) {\n                    Some(true) => {}\n                    _ => return Err(format!(\"{section}[{i}] needs a string `name` field\")),\n                }\n            }\n        }\n    }\n    Ok(())\n}","typeGuard":"fn has_string_name(v: &serde_yaml::Value) -> bool {\n    v.get(\"name\").map(|n| n.is_string()).unwrap_or(false)\n}","tryCatchPattern":"match pin_versions(input, &roles, &collections) {\n    Err(e) if e.to_string().contains(\"missing or invalid `name`\") => {\n        eprintln!(\"Add name: <dep> to every entry; quote numeric-looking names\\n{e}\");\n    }\n    other => other,\n}","preventionTips":["Every entry needs `name:`; `src:`/`version:`-only entries are rejected","Quote names that YAML might infer as numbers or booleans","Rename legacy `src:` keys to `name:`","Assert each entry has a string name before pinning versions"],"tags":["yaml","ansible","requirements","missing-field"],"backgroundTag":"invalid-dependency-manifest-entry","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"}