juanfont/headscale · error · ErrUndefinedTagReference
tag %q %w %q
Error message
tag %q %w %q
What it means
Error "tag %q %w %q" thrown in juanfont/headscale.
Source
Thrown at hscontrol/policy/v2/policy.go:1674
// edge and contribute no addresses; non-cycle owners on the cycled tags
// still resolve. Undefined-tag references remain a hard error.
func flattenTags(tagOwners TagOwners, tag Tag, visiting map[Tag]bool, chain []Tag) (Owners, error) {
if visiting[tag] {
return nil, nil
}
visiting[tag] = true
chain = append(chain, tag)
defer delete(visiting, tag)
var result Owners
for _, owner := range tagOwners[tag] {
switch o := owner.(type) {
case *Tag:
if _, ok := tagOwners[*o]; !ok {
return nil, fmt.Errorf("tag %q %w %q", tag, ErrUndefinedTagReference, *o)
}
nested, err := flattenTags(tagOwners, *o, visiting, chain)
if err != nil {
return nil, err
}
result = append(result, nested...)
default:
result = append(result, owner)
}
}
return result, nil
}
// flattenTagOwners flattens all [TagOwners] by resolving nested tags and detecting cycles.
// It will return a new [TagOwners] map where all the [Tag] types have been resolved to their underlying [Owners].View on GitHub (pinned to 565fd254d0)
Solutions
- Inspect the wrapped error for the underlying cause and correct the failing condition (tag); retry the operation after fixing the input, configuration, or environment.
Example fix
Inspect the wrapped error for the underlying cause and correct the failing condition (tag); retry the operation after fixing the input, configuration, or environment.
When it happens
Trigger: Thrown at hscontrol/policy/v2/policy.go:1674 when the library encounters an invalid state.
Common situations: A tag reference in the policy is invalid or undefined. Define the tag in tagOwners and ensure it starts with 'tag:'.
AI-assisted analysis of juanfont/headscale@565fd254d0 (2026-08-15).
Data as JSON: /api/errors/dfbec91fa85d8549.
Report an issue: GitHub.