windmill-labs/windmill · error

YAML parse error: {}

Error message

YAML parse error: {}

What it means

add_versions_to_requirements_yaml parses the raw requirements YAML string with YamlLoader before doing any version pinning. This error wraps any syntax error reported by the underlying yaml-rust loader — malformed indentation, bad characters, unbalanced quotes/brackets, tabs, etc. — and aborts before roles/collections are touched.

Source

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

                }
            } else {
                return Err(anyhow!(
                    "{section} dependency element: missing or invalid `name` field"
                ));
            }
        }
    }

    Ok(logs)
}

pub fn add_versions_to_requirements_yaml(
    input: &str,
    role_versions: &HashMap<String, String>,
    collection_versions: &HashMap<String, String>,
) -> anyhow::Result<(String, String)> {
    let mut docs =
        YamlLoader::load_from_str(input).map_err(|e| anyhow!("YAML parse error: {}", e))?;
    let doc = &mut docs[0];

    let mut logs = String::new();

    logs.push_str(
        &update_versions("roles", doc, role_versions)
            .map_err(|e| anyhow!("Error updating role versions: {e}"))?,
    );
    logs.push_str(
        &update_versions("collections", doc, collection_versions)
            .map_err(|e| anyhow!("Error updating collection versions: {e}"))?,
    );

    if !logs.is_empty() {
        logs.push_str("WARNING: You might want to try adding manual versions for these, otherwise there could be breaking changes on deployed scripts\n");
    }

    let mut out_str = String::new();

View on GitHub (pinned to e474e8803c)

Solutions

  1. Run a YAML linter (yamllint or an online parser) on the input and fix the reported line/column — the wrapped yaml-rust message includes the position.
  2. Replace tab indentation with spaces.
  3. Remove merge-conflict markers and smart quotes/non-ASCII whitespace.
  4. Quote scalars containing `: ` or `#` to avoid ambiguous syntax.

Example fix

# before (tab indentation)
roles:
	- name: geerlingguy.docker
# after
roles:
  - name: geerlingguy.docker
Defensive patterns

Strategy: try-catch

Validate before calling

fn precheck_yaml(input: &str) -> Result<(), String> {
    serde_yaml::from_str::<serde_yaml::Value>(input)
        .map(|_| ())
        .map_err(|e| format!("invalid YAML before calling API: {e}"))
}

Try / catch

match pin_versions(input, &roles, &collections) {
    Err(e) if e.to_string().starts_with("YAML parse error") => {
        eprintln!("Fix YAML syntax (tabs, quotes, merge markers) before retrying\n{e}");
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling add_versions_to_requirements_yaml with input that yaml-rust cannot parse: tabs for indentation, an unclosed quote in a name, a stray `:` in a scalar, `@` at invalid positions, or truncated file content.

Common situations: Hand-edited requirements files with tab indentation; copy-paste introducing smart quotes or non-breaking spaces; merged-conflict markers (<<<<<<<) left in the file; truncation from a failed edit.

Understand the failure class

Related errors


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