{"record":{"id":"6f62d5d850632e80","repo":"glanceapp/glance","slug":"parsing-config-w","errorCode":null,"errorMessage":"parsing config: %w","messagePattern":"parsing config: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/glance/main.go","lineNumber":154,"sourceCode":"\t\t}\n\n\t\tgo func() {\n\t\t\tvar startServer func() error\n\t\t\tstartServer, stopServer = app.server()\n\n\t\t\tif err := startServer(); err != nil {\n\t\t\t\tlog.Printf(\"Failed to start server: %v\", err)\n\t\t\t}\n\t\t}()\n\t}\n\n\tonErr := func(err error) {\n\t\tlog.Printf(\"Error watching config files: %v\", err)\n\t}\n\n\tconfigContents, configIncludes, err := parseYAMLIncludes(configPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parsing config: %w\", err)\n\t}\n\n\tstopWatching, err := configFilesWatcher(configPath, configContents, configIncludes, onChange, onErr)\n\tif err == nil {\n\t\tdefer stopWatching()\n\t} else {\n\t\tlog.Printf(\"Error starting file watcher, config file changes will require a manual restart. (%v)\", err)\n\n\t\tconfig, err := newConfigFromYAML(configContents)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"validating config file: %w\", err)\n\t\t}\n\n\t\tapp, err := newApplication(config)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"creating application: %w\", err)\n\t\t}\n","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/glanceapp/glance/blob/91324e8de762702e97b0ac5c8e36271d644d8642/internal/glance/main.go#L136-L172","documentation":"Top-level startup error from main.go when parseYAMLIncludes(configPath) fails — the glance.yml itself cannot be read or parsed, or an `!include` directive inside it points to a missing/invalid file. The %w chain preserves the underlying parse error with file and line info.","triggerScenarios":"glance.yml has a YAML syntax error (tabs, bad indent, unclosed quote); the config path passed via -config doesn't exist; an include target file is missing or itself invalid; include path escaping the allowed scope.","commonSituations":"First run with a mistyped -config path; editing the config in an editor that inserts tabs; renaming/moving included snippet files without updating the directives; container mounts missing the config or include directory.","solutions":["Read the wrapped error: it names the file and line of the YAML problem","Verify the config path and every !include target exists and is readable inside the container/host respectively","Replace tabs with spaces and fix indentation/quotes in the reported file","Run a YAML lint or `glance config-check` if available before restart"],"exampleFix":"# before\nserver:\n\thost: 0.0.0.0   # tab indent\n# after\nserver:\n  host: 0.0.0.0   # spaces\n","handlingStrategy":"validation","validationCode":"// Parse includes the same way glance does, before launching\nif _, _, err := parseYAMLIncludes(path); err != nil { // internal: replicate with yaml.Unmarshal if not exported\n    return err\n}\n// Or simply: yaml.Unmarshal(osReadFile(path), &map[string]any{}) for syntax checking\n","typeGuard":null,"tryCatchPattern":"Catch the wrapped error and present file:line from the chain; treat as a hard stop for deployment pipelines.","preventionTips":["Run `glance config-check` or a YAML lint in CI","Use spaces, never tabs, in glance.yml","Keep !include paths relative to the config dir and verify mounts"],"tags":["yaml","config","startup","includes"],"backgroundTag":null,"analyzedSha":"91324e8de762702e97b0ac5c8e36271d644d8642","analyzedAt":"2026-08-15T14:12:54.279Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}