Validate Your YAML (Linter)
The Valohai linter catches syntax errors, indentation issues, and configuration mistakes in your valohai.yaml before you commit or launch a job.
It's faster to fix a typo locally than to wait for a job to fail in the cloud.
Why Use the Linter?
Catch errors early: Find syntax mistakes, missing required fields, and invalid configurations before execution.
Save time and money: Avoid spinning up expensive GPU instances only to have them crash due to a YAML typo.
Learn YAML syntax: The linter explains what's wrong and where, helping you understand YAML structure.
Run the Linter
Make sure you have the Valohai CLI installed and you're in a directory linked to a Valohai project.
Then run:
vh lintThe linter will scan your valohai.yaml and report any issues.
Common Errors the Linter Catches
Indentation errors
YAML is whitespace-sensitive. The linter catches misaligned blocks:
Missing required fields
Steps must have name, image, and command:
Invalid parameter types
Parameters must specify a valid type:
Syntax mistakes
Forgotten colons, quotes, or brackets:
Example Linter Output
When you run vh lint, for a valid valohai.yaml you'll see output like this:
What the Linter Doesn't Catch
The linter validates YAML structure and Valohai-specific syntax, but it can't catch:
Logic errors: If your command references a file that doesn't exist, the linter won't know
Runtime issues: Missing Python packages or incorrect paths will only surface during execution
Input availability: The linter doesn't check if the input URLs actually exist
Think of it as a spell-checker, not a code reviewer.
Best Practices
Lint before every commit: Make it part of your workflow. Run vh lint before pushing to Git.
Fix warnings, not just errors: Warnings often point to configuration issues that will cause problems later.
What's Next?
Generate YAML with valohai-utils to skip writing YAML by hand (Python users)
Multiple YAML files for monorepo projects
Managing large YAML files with anchors and aliases
Last updated
Was this helpful?
