Skip to content

no-undefined-alias

Reports an alias that names an anchor not defined earlier in the same document, on the alias.

YAML requires the anchor to come first, in the same document, so the file is invalid and a parser stops with an error.

To fix, define the anchor above the alias, or fix the name.

Reported
a: &x 1
---
b: *x
github-actions:
lint:
rules:
no-undefined-alias: error # off, warn, error (default)
yaml:
lint:
rules:
no-undefined-alias: error # off, warn, error (default)

Enabled by the presets: yaml/yamllint, github-actions/actionlint.

Suppress one line with sudsy-disable-next-line no-undefined-alias in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
actionlint syntax-check/undefined-alias partial The shared YAML rule, enabled by the preset for workflows.
yamllint anchors full
yamllint anchors.forbid-undeclared-aliases full