windmill-labs/windmill · error
Expected `target` field (target directory for cloning the re
Error message
Expected `target` field (target directory for cloning the repo)
What it means
parse_git_repo throws this when a repo map in `git_repos` has no string `target` key. The target is the relative directory where the repo will be cloned so the ansible playbook can read it; the parser requires it and the message explains its purpose. Missing key or a non-string value both trigger it.
Source
Thrown at backend/parsers/windmill-parser-yaml/src/lib.rs:683
return None;
}
fn parse_git_repo(r: &Yaml) -> anyhow::Result<GitRepo> {
let Yaml::Hash(repo) = r else {
return Err(anyhow!("Should be a Map"));
};
let url = repo
.get(&Yaml::String("url".to_string()))
.and_then(|v| v.as_str())
.map(|s| s.to_string())
.ok_or(anyhow!("Expected `url` field"))?;
let target_path = repo
.get(&Yaml::String("target".to_string()))
.and_then(|v| v.as_str())
.map(|s| s.to_string())
.ok_or(anyhow!(
"Expected `target` field (target directory for cloning the repo)"
))?;
let branch = repo
.get(&Yaml::String("branch".to_string()))
.and_then(|v| v.as_str())
.map(|s| s.to_string());
let commit = repo
.get(&Yaml::String("commit".to_string()))
.and_then(|v| v.as_str())
.map(|s| s.to_string());
Ok(GitRepo { url, commit, branch, target_path })
}
fn parse_ansible_options(opts: &Vec<Yaml>) -> AnsiblePlaybookOptions {
let mut ret = AnsiblePlaybookOptions {View on GitHub (pinned to e474e8803c)
Solutions
- Add a `target` key with a relative directory path string to each repo entry
- Ensure the value is a string, e.g. `target: repo`
- Fix key typos so the key is exactly `target`
- Use a distinct target per repo to avoid clone collisions
Example fix
# before
git_repos:
- url: https://github.com/org/repo.git
# after
git_repos:
- url: https://github.com/org/repo.git
target: repo Defensive patterns
Strategy: validation
Validate before calling
fn require_target(repo: &serde_yaml::Mapping) -> Result<&str, String> {
repo.get(serde_yaml::Value::String("target".into()))
.and_then(|v| v.as_str())
.ok_or_else(|| "repo entry requires a string `target` field (clone directory)".to_string())
} Type guard
fn has_string_field(v: &Yaml, key: &str) -> bool {
matches!(v, Yaml::Hash(m) if matches!(m.get(&Yaml::String(key.into())), Some(Yaml::String(_))))
} Prevention
- Always set `target` for each repo, even if cloning to a simple name
- Use a relative path and a distinct directory per repo
- Check the key is exactly `target`, not path/destination
When it happens
Trigger: A git_repos entry map provides `url` but no `target`, or `target`'s value is not a YAML string (integer, boolean, null, nested map).
Common situations: Assuming the repo clones into the working dir without a target; typo (`destination:`, `path:`); target value written as a number; forgetting the field when copy-editing an existing entry.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Failed to parse git repo: {e}
- Should be a Map
- Expected `url` field
- git_repos field expects an array of repos
- git_ssh_identity expects an array of windmill variables (or
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/97b9e78ff5161d33.
Report an issue: GitHub.