windmill-labs/windmill · error

Failed to parse git repo: {e}

Error message

Failed to parse git repo: {e}

What it means

Wrapper error raised by parse_ansible_reqs when one element of the `git_repos` array fails parse_git_repo. The inner error (`Should be a Map`, missing `url`, missing `target`) is re-wrapped with the prefix 'Failed to parse git repo: ' so the developer knows which list context failed. It indicates one repo entry inside the git_repos list is malformed.

Source

Thrown at backend/parsers/windmill-parser-yaml/src/lib.rs:580

                        };
                        validate_vault_id(filename)?;
                        ret.vault_id.push(filename.to_string());
                    }
                }
                Yaml::String(key) if key == "options" => {
                    if let Yaml::Array(opts) = &value {
                        ret.options = parse_ansible_options(opts);
                    }
                }
                Yaml::String(key) if key == "git_repos" => {
                    let Yaml::Array(repos) = &value else {
                        return Err(anyhow!("git_repos field expects an array of repos"));
                    };

                    for r in repos {
                        ret.git_repos.push(
                            parse_git_repo(r)
                                .map_err(|e| anyhow!("Failed to parse git repo: {e}"))?,
                        );
                    }
                }
                Yaml::String(key) if key == "git_ssh_identity" => {
                    extract_ssh_identity(&value, &mut ret.git_ssh_identity)?;
                }
                Yaml::String(key) if key == "delegate_to_git_repo" => {} // Skip this because it was already parsed before
                Yaml::String(key) => logs.push_str(&format!("\nUnknown field `{}`. Ignoring", key)),
                _ => (),
            }
        }
    }

    let mut out_str = String::new();
    let mut emitter = YamlEmitter::new(&mut out_str);

    for i in 1..docs.len() {
        emitter.dump(&docs[i])?;

View on GitHub (pinned to e474e8803c)

Solutions

  1. Read the inner message after the prefix to see the actual cause (not a map, missing `url`, or missing `target`)
  2. Make each list element a map with at least `url` and `target` string keys
  3. Remove or fix null/empty entries in the git_repos list
  4. Check indentation: `url`/`target` must be indented under the same list item

Example fix

# before
git_repos:
  - https://github.com/org/repo.git

# after
git_repos:
  - url: https://github.com/org/repo.git
    target: repo
Defensive patterns

Strategy: try-catch

Validate before calling

fn validate_git_repos_entries(value: &Yaml) -> Result<(), String> {
    if let Yaml::Array(repos) = value {
        for r in repos {
            if let Yaml::Hash(m) = r {
                m.get(&Yaml::String("url".into())).and_then(|v| v.as_str())
                    .ok_or("repo missing string url")?;
                m.get(&Yaml::String("target".into())).and_then(|v| v.as_str())
                    .ok_or("repo missing string target")?;
            } else {
                return Err("each git_repos entry must be a map".into());
            }
        }
    }
    Ok(())
}

Try / catch

match parse_assets(yaml) {
    Err(e) if e.to_string().starts_with("Failed to parse git repo:") => {
        // inspect inner cause after the prefix and fix the offending repo entry
    }
    other => other?,
}

Prevention

When it happens

Trigger: parse_ansible_reqs iterating the `git_repos` array encounters an element that is not a map, or a map lacking a string `url` or string `target` field; parse_git_repo returns Err and the map_err wraps it.

Common situations: A list item accidentally written as a string URL instead of a map; typos like `uurl:` or `targetPath:` instead of `url:`/`target:`; a null list entry (`-`); quoting/indentation errors turning a map into a scalar.

Understand the failure class

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/7f85c18e1aa46116. Report an issue: GitHub.