windmill-labs/windmill · error

Expected `url` field

Error message

Expected `url` field

What it means

parse_git_repo throws this when a repo map in `git_repos` has no string `url` key. The url is mandatory because it identifies the repository to clone; the parser uses `.ok_or` after looking up the key and calling `as_str()`, so both a missing key and a non-string url value produce this error.

Source

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

                vars_location,
                ansible_cfg,
                install_requirements,
            });
        }
    }
    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());

View on GitHub (pinned to e474e8803c)

Solutions

  1. Add a `url` key with the git clone URL string to each repo entry
  2. Ensure the url value is a plain/quoted string, not a number or nested structure
  3. Fix key-name typos so the key is exactly `url`
  4. Verify indentation places `url` under the correct repo list item

Example fix

# before
git_repos:
  - target: repo

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

Strategy: validation

Validate before calling

fn require_url(repo: &serde_yaml::Mapping) -> Result<&str, String> {
    repo.get(serde_yaml::Value::String("url".into()))
        .and_then(|v| v.as_str())
        .ok_or_else(|| "repo entry requires a string `url` field".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

When it happens

Trigger: A git_repos entry map lacks the `url` key entirely, or its value is a non-string YAML type (integer, boolean, nested map, null) so `as_str()` returns None.

Common situations: Typos (`uri:`, `repo:`, `repository:`); forgetting the key when only writing `target`/`branch`; quoting mistakes leaving the value as another type; the URL value accidentally unindented to a sibling key.

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


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