glanceapp/glance · error
line %d: %w
Error message
line %d: %w
What it means
While unmarshalling the widgets list of a page, creating a widget (almost always the unknown-type error) failed, and the error is re-wrapped with the YAML node's line number. The line points at the offending widget block in glance.yml so you can jump straight to the bad entry.
Source
Thrown at internal/glance/widget.go:113
func (w *widgets) UnmarshalYAML(node *yaml.Node) error {
var nodes []yaml.Node
if err := node.Decode(&nodes); err != nil {
return err
}
for _, node := range nodes {
meta := struct {
Type string `yaml:"type"`
}{}
if err := node.Decode(&meta); err != nil {
return err
}
widget, err := newWidget(meta.Type)
if err != nil {
return fmt.Errorf("line %d: %w", node.Line, err)
}
if err = node.Decode(widget); err != nil {
return err
}
*w = append(*w, widget)
}
return nil
}
type widget interface {
// These need to be exported because they get called in templates
Render() template.HTML
GetType() string
GetID() uint64
View on GitHub (pinned to 91324e8de7)
Solutions
- Open glance.yml at the reported line and read the widget's type field
- Correct or remove the type value per the inner error message
- Re-run glance (or reload config) to confirm the page parses
Example fix
# glance.yml, at the reported line: # before (line 42) - type: serverstats # after - type: server-stats
Defensive patterns
Strategy: validation
Type guard
func isWidgetLineErr(err error) bool {
var lineErr interface{ error }
_ = lineErr
return err != nil && strings.HasPrefix(err.Error(), "line ")
} Try / catch
if err := yaml.Unmarshal(data, &pages); err != nil {
if isWidgetLineErr(err) {
// parse 'line N' out of the message and point the user at that entry in glance.yml
log.Printf("config error near %s — check the type field there", err)
}
os.Exit(1)
} Prevention
- Use the line number in the message to jump directly to the broken block instead of bisecting the file
- Validate the full config with `glance validate`-style checks (or a dry parse) after edits
When it happens
Trigger: Any widget node on the indicated line whose type value does not match a known widget; the line number is where that widget mapping starts in the YAML file.
Common situations: Large config files where finding the bad block is hard; the line number plus the inner 'unknown widget type: X' message together pinpoint the exact entry to fix.
Related errors
- widget 'type' property is empty or not specified
- unknown widget type: %s
- URL is required
- nested groups are not supported
- split columns inside of groups are not supported
AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15).
Data as JSON: /api/errors/ac44bed2ad1972fa.
Report an issue: GitHub.