windmill-labs/windmill · error

Error parsing yaml ${path}

Error message

Error parsing yaml ${path}

What it means

`yamlParseFile` reads a file and parses it as YAML with Windmill's custom tags. If reading or parsing fails for any reason, it wraps the original error with `Error parsing yaml <path>` (keeping the cause) so the failing file is identified.

Source

Thrown at cli/src/utils/yaml.ts:34

const inlineFilesetTag: ScalarTag = {
  tag: "!inline_fileset",
  resolve(value: string) {
    return "!inline_fileset " + value;
  },
};

const WINDMILL_CUSTOM_TAGS: ScalarTag[] = [inlineTag, inlineFilesetTag];

type YamlParseOptions = ParseOptions & DocumentOptions & SchemaOptions & ToJSOptions;

export async function yamlParseFile(path: string, options: YamlParseOptions = {}) {
  try {
    return yamlParse(await readTextFile(path), {
      ...options,
      customTags: [...WINDMILL_CUSTOM_TAGS, ...((options.customTags as ScalarTag[] | undefined) ?? [])],
    });
  } catch (e) {
    throw new Error(`Error parsing yaml ${path}`, { cause: e });
  }
}

export function yamlParseContent(
  path: string,
  content: string,
  options: YamlParseOptions = {},
) {
  try {
    return yamlParse(content, {
      ...options,
      customTags: [...WINDMILL_CUSTOM_TAGS, ...((options.customTags as ScalarTag[] | undefined) ?? [])],
    });
  } catch (e) {
    throw new Error(`Error parsing yaml ${path}`, { cause: e });
  }
}

View on GitHub (pinned to e474e8803c)

Solutions

  1. Inspect the `cause` for the exact parser line/column and fix the syntax (common: tabs instead of spaces, wrong indentation)
  2. Verify the file is UTF-8 encoded (readTextFile rejects UTF-16/32 and its errors get wrapped here)
  3. Validate locally before deploying: `yq . <path>` or a YAML linter; check the path exists

Example fix

// before (script.yaml)
summary: x
	tabs cause parse error
// after
summary: x
  description: uses spaces
Defensive patterns

Strategy: try-catch

Validate before calling

const yaml = require('js-yaml');
try { yaml.load(require('fs').readFileSync(path, 'utf8')); }
catch (e) { throw new Error(`${path} is not valid YAML: ${e.message}`); }

Try / catch

try {
  const def = await yamlParseFile(path);
} catch (e) {
  console.error(`YAML error in ${path}:`, e.cause ?? e);
  // cause holds the original parser error with line/column details
}

Prevention

When it happens

Trigger: Running commands that load YAML definitions (`wmill app`, `wmill script`/`runnable` from local files, `wmill lint raw-app`, local app flows) against a file with YAML syntax errors, tabs used for indentation, or an unsupported encoding thrown by `readTextFile`.

Common situations: Hand-edited YAML with bad indentation or duplicate keys; a file saved as UTF-16 by PowerShell; a nonexistent file path (read error wrapped too); windmill custom tags misused.

Related errors


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