windmill-labs/windmill · error

No `target` provided for the file. Please input a target pat

Error message

No `target` provided for the file. Please input a target path (only relative paths are allowed) where the ansible playbook can read this file.

What it means

parse_file_resource throws this when a `file` entry in an ansible playbook asset's requirements has no string `target` key. The target is the relative path where the file resource must be placed so the ansible playbook can read it at runtime; it is mandatory. The message explicitly notes only relative paths are allowed.

Source

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

            if current_count == 6 {
                return 6; // Stop early if we reach 6
            }
        } else {
            current_count = 0; // Reset count if the character is not 'v'
        }
        max_count = max_count.max(current_count);
    }

    max_count
}

fn parse_file_resource(yaml: &Yaml) -> anyhow::Result<FileResource> {
    if let Yaml::Hash(f) = yaml {
        let target_path = f
            .get(&Yaml::String("target".to_string()))
            .and_then(|x| x.as_str())
            .map(|x| x.to_string())
            .ok_or(anyhow!(
                "No `target` provided for the file. Please input a target path (only relative paths are allowed) where the ansible playbook can read this file.",
            ))?;

        let mut mode = None;
        if let Some(u) = f.get(&Yaml::String("mode".to_string())) {
            let mode_val: u32 = match u {
                Yaml::Integer(u) => {
                    u.clone().try_into().map_err(|e| {
                        anyhow!(
                            "Invalid value for `mode` permissions property on targeted file to: {}, err: {e}",
                            target_path
                        )
                    })?
                }
                Yaml::String(s) => {
                    let val = if s.starts_with("0b") {
                        u32::from_str_radix(&s[2..], 2)
                    } else if s.starts_with("0o") {

View on GitHub (pinned to e474e8803c)

Solutions

  1. Add a `target` key with a relative path string where the playbook will read the file
  2. Ensure the value is a string, e.g. `target: files/config.yml`
  3. Do not use absolute paths; the parser only allows relative targets
  4. Fix key typos so the key is exactly `target`

Example fix

# before
files:
  - resource: my_config

# after
files:
  - resource: my_config
    target: config.yml
Defensive patterns

Strategy: validation

Validate before calling

fn validate_file_entry(f: &serde_yaml::Mapping) -> Result<(), String> {
    f.get(serde_yaml::Value::String("target".into()))
        .and_then(|v| v.as_str())
        .filter(|p| !p.starts_with('/'))
        .map(|_| ())
        .ok_or_else(|| "file entry requires a relative string `target` path".to_string())
}

Type guard

fn has_relative_target(v: &Yaml) -> bool {
    matches!(v, Yaml::Hash(m) if matches!(
        m.get(&Yaml::String("target".into())), Some(Yaml::String(p)) if !p.starts_with('/')))
}

Prevention

When it happens

Trigger: parse_assets processes a file resource whose YAML map lacks `target`, or whose `target` value is not a string, so `.ok_or` fires.

Common situations: Writing only `resource:` without `target:`; assuming files are placed automatically by resource name; typo (`destination:`, `path:`); copying a git_repos-style entry that also happens to omit target.

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/6fa879d87d72c82b. Report an issue: GitHub.