glanceapp/glance · critical

parsing config: %w

Error message

parsing config: %w

What it means

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.

Source

Thrown at internal/glance/main.go:154

		}

		go func() {
			var startServer func() error
			startServer, stopServer = app.server()

			if err := startServer(); err != nil {
				log.Printf("Failed to start server: %v", err)
			}
		}()
	}

	onErr := func(err error) {
		log.Printf("Error watching config files: %v", err)
	}

	configContents, configIncludes, err := parseYAMLIncludes(configPath)
	if err != nil {
		return fmt.Errorf("parsing config: %w", err)
	}

	stopWatching, err := configFilesWatcher(configPath, configContents, configIncludes, onChange, onErr)
	if err == nil {
		defer stopWatching()
	} else {
		log.Printf("Error starting file watcher, config file changes will require a manual restart. (%v)", err)

		config, err := newConfigFromYAML(configContents)
		if err != nil {
			return fmt.Errorf("validating config file: %w", err)
		}

		app, err := newApplication(config)
		if err != nil {
			return fmt.Errorf("creating application: %w", err)
		}

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Read the wrapped error: it names the file and line of the YAML problem
  2. Verify the config path and every !include target exists and is readable inside the container/host respectively
  3. Replace tabs with spaces and fix indentation/quotes in the reported file
  4. Run a YAML lint or `glance config-check` if available before restart

Example fix

# before
server:
	host: 0.0.0.0   # tab indent
# after
server:
  host: 0.0.0.0   # spaces
Defensive patterns

Strategy: validation

Validate before calling

// Parse includes the same way glance does, before launching
if _, _, err := parseYAMLIncludes(path); err != nil { // internal: replicate with yaml.Unmarshal if not exported
    return err
}
// Or simply: yaml.Unmarshal(osReadFile(path), &map[string]any{}) for syntax checking

Try / catch

Catch the wrapped error and present file:line from the chain; treat as a hard stop for deployment pipelines.

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15). Data as JSON: /api/errors/6f62d5d850632e80. Report an issue: GitHub.