{"record":{"id":"ac44bed2ad1972fa","repo":"glanceapp/glance","slug":"line-d-w","errorCode":null,"errorMessage":"line %d: %w","messagePattern":"line (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/glance/widget.go","lineNumber":113,"sourceCode":"func (w *widgets) UnmarshalYAML(node *yaml.Node) error {\n\tvar nodes []yaml.Node\n\n\tif err := node.Decode(&nodes); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, node := range nodes {\n\t\tmeta := struct {\n\t\t\tType string `yaml:\"type\"`\n\t\t}{}\n\n\t\tif err := node.Decode(&meta); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\twidget, err := newWidget(meta.Type)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"line %d: %w\", node.Line, err)\n\t\t}\n\n\t\tif err = node.Decode(widget); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t*w = append(*w, widget)\n\t}\n\n\treturn nil\n}\n\ntype widget interface {\n\t// These need to be exported because they get called in templates\n\tRender() template.HTML\n\tGetType() string\n\tGetID() uint64\n","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/glanceapp/glance/blob/91324e8de762702e97b0ac5c8e36271d644d8642/internal/glance/widget.go#L95-L131","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# glance.yml, at the reported line:\n# before (line 42)\n- type: serverstats\n\n# after\n- type: server-stats","handlingStrategy":"validation","validationCode":null,"typeGuard":"func isWidgetLineErr(err error) bool {\n\tvar lineErr interface{ error }\n\t_ = lineErr\n\treturn err != nil && strings.HasPrefix(err.Error(), \"line \")\n}","tryCatchPattern":"if err := yaml.Unmarshal(data, &pages); err != nil {\n    if isWidgetLineErr(err) {\n        // parse 'line N' out of the message and point the user at that entry in glance.yml\n        log.Printf(\"config error near %s — check the type field there\", err)\n    }\n    os.Exit(1)\n}","preventionTips":["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"],"tags":["config","yaml","widget","debugging"],"backgroundTag":null,"analyzedSha":"91324e8de762702e97b0ac5c8e36271d644d8642","analyzedAt":"2026-08-15T14:12:54.279Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}