{"record":{"id":"4f659c9cbe43b759","repo":"windmill-labs/windmill","slug":"should-be-a-map","errorCode":null,"errorMessage":"Should be a Map","messagePattern":"Should be a Map","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-yaml/src/lib.rs","lineNumber":670,"sourceCode":"                .unwrap_or(false);\n\n            return Some(DelegateToGitRepoDetails {\n                resource,\n                playbook,\n                commit,\n                inventories_location,\n                vars_location,\n                ansible_cfg,\n                install_requirements,\n            });\n        }\n    }\n    return None;\n}\n\nfn parse_git_repo(r: &Yaml) -> anyhow::Result<GitRepo> {\n    let Yaml::Hash(repo) = r else {\n        return Err(anyhow!(\"Should be a Map\"));\n    };\n\n    let url = repo\n        .get(&Yaml::String(\"url\".to_string()))\n        .and_then(|v| v.as_str())\n        .map(|s| s.to_string())\n        .ok_or(anyhow!(\"Expected `url` field\"))?;\n\n    let target_path = repo\n        .get(&Yaml::String(\"target\".to_string()))\n        .and_then(|v| v.as_str())\n        .map(|s| s.to_string())\n        .ok_or(anyhow!(\n            \"Expected `target` field (target directory for cloning the repo)\"\n        ))?;\n\n    let branch = repo\n        .get(&Yaml::String(\"branch\".to_string()))","sourceCodeStart":652,"sourceCodeEnd":688,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-yaml/src/lib.rs#L652-L688","documentation":"parse_git_repo throws 'Should be a Map' when an element of the `git_repos` array is not a YAML mapping (hash). Each repo entry must be a map with keys like `url`, `target`, and optionally `branch`/`commit`. Scalars, strings, or sequences in the list fail the `Yaml::Hash` destructuring.","triggerScenarios":"parse_ansible_reqs passes each `git_repos` item to parse_git_repo; an item that is a plain string URL, a number, a list, or null hits the `Yaml::Hash` else-branch and returns this error (later wrapped as 'Failed to parse git repo: Should be a Map').","commonSituations":"Listing bare URLs (`- https://github.com/org/repo.git`) instead of repo maps; wrong indentation turning a map into a multi-item list fragment; a null entry from an empty list item.","solutions":["Convert each entry into a map: `- url: <repo-url>` with `target` under it","Do not list raw URL strings; the parser has no shorthand for them","Check indentation so each repo's keys belong to the same list item","Remove empty or null list entries"],"exampleFix":"# before\ngit_repos:\n  - https://github.com/org/repo.git\n\n# after\ngit_repos:\n  - url: https://github.com/org/repo.git\n    target: repo","handlingStrategy":"validation","validationCode":"fn validate_git_repo_entries(value: &Yaml) -> Result<(), String> {\n    if let Yaml::Array(repos) = value {\n        for (i, r) in repos.iter().enumerate() {\n            if !matches!(r, Yaml::Hash(_)) {\n                return Err(format!(\"git_repos[{}] is not a map; use `- url: ...` list items\", i));\n            }\n        }\n    }\n    Ok(())\n}","typeGuard":"fn is_yaml_map(v: &Yaml) -> bool {\n    matches!(v, Yaml::Hash(_))\n}","tryCatchPattern":null,"preventionTips":["Never list raw URL strings; each entry must be a map","Verify indentation keeps each repo's keys under one `-` item","Remove null/empty list entries"],"tags":["yaml","ansible","git","parser"],"backgroundTag":"yaml-schema-validation","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"}