Invalid YAML Alias – Fix Malformed *anchor References

Local only

A YAML alias begins with * and must include a valid identifier that refers to an anchor. A bare asterisk is not a complete alias value.

7 chars · 1 line

Waiting for input

Loading YAML parser…

YAML anchor and alias troubleshooting

How to fix an invalid YAML alias

The preloaded mapping assigns a bare * to copy. YAML interprets * as the start of an alias, so it needs a valid alias name and normally a corresponding anchor defined earlier in the document. This tool is free to use. No account or payment is required.

Last updated

What you can do here

  • YAML 1.2 parser validation
  • Duplicate mapping key detection
  • Preloaded broken YAML example
  • Readable parser feedback
  • .yaml and .yml file import
  • Browser-local processing

Steps

  1. Locate the * token reported by the parser and determine whether it should be a YAML alias.
  2. If it is an alias, give it a valid name and confirm the matching &anchor appears before the reference.
  3. If it is literal text, quote the value instead, then validate the full document again.

Aliases are references, not wildcard strings

YAML uses &name to anchor a node and *name to reference it later. Because * has structural meaning at the start of a node, a bare asterisk cannot stand alone as an ordinary scalar.

Anchor order matters to alias resolution

A well-formed alias name is only part of the check. The referenced anchor should be available before the alias is used, so review both syntax and document order when an alias still fails after naming it.

Malformed YAML alias example

A named anchor is defined first and then referenced with the matching alias.

Invalid YAML

copy: *

Corrected YAML

base: &defaults
  enabled: true
copy: *defaults

Common questions

Frequently asked questions

What does *name mean in YAML?

It is an alias reference to a node previously marked with the matching &name anchor.

Can I use a bare * as a YAML string?

Not as an unquoted scalar at the start of a value because YAML interprets it as alias syntax. Quote it if the asterisk itself is the data you need.

Does an alias need its anchor before it?

A YAML alias is expected to resolve to a preceding anchor in the document, so define the anchor before the alias reference.

Debugging a specific YAML issue? Browse YAML troubleshooting.