mikefarah/yq · error
could not load tz [%v]: %w
Error message
could not load tz [%v]: %w
What it means
The tz operator passed its timezone argument to time.LoadLocation and the IANA database lookup failed. The named zone (shown in brackets) is not a valid IANA timezone identifier or the zoneinfo database is unavailable on this system; the %w wraps Go's own error detail.
Source
Thrown at pkg/yqlib/operator_datetime.go:109
node.Key = candidate.Key
results.PushBack(node)
}
return context.ChildContext(results), nil
}
func tzOp(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
timezoneStr, err := getStringParameter("timezone", d, context, expressionNode.RHS)
layout := context.GetDateTimeLayout()
if err != nil {
return Context{}, err
}
var results = list.New()
timezone, err := time.LoadLocation(timezoneStr)
if err != nil {
return Context{}, fmt.Errorf("could not load tz [%v]: %w", timezoneStr, err)
}
for el := context.MatchingNodes.Front(); el != nil; el = el.Next() {
candidate := el.Value.(*CandidateNode)
parsedTime, err := parseDateTime(layout, candidate.Value)
if err != nil {
return Context{}, fmt.Errorf("could not parse datetime of [%v] using layout [%v]: %w", candidate.GetNicePath(), layout, err)
}
tzTime := parsedTime.In(timezone)
results.PushBack(candidate.CreateReplacement(ScalarNode, candidate.Tag, tzTime.Format(layout)))
}
return context.ChildContext(results), nil
}
func parseUnixTime(unixTime string) (time.Time, error) {View on GitHub (pinned to 8b5af0694b)
Solutions
- Use a valid IANA name such as "Australia/Sydney" or "UTC" (not "AEST", not "GMT+10")
- Check spelling of the zone name
- On systems without tzdata, ensure Go can find it (embed tzdata or set ZONEINFO)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/yqlib/operator_datetime.go:109 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of mikefarah/yq@8b5af0694b (2026-09-05).
Data as JSON: /api/errors/f59576fdd2e90c38.
Report an issue: GitHub.