glanceapp/glance · error

creating application: %w

Error message

creating application: %w

What it means

Startup error wrapping any failure from newApplication(config) in the watcher-less fallback path. This aggregates all application initialization errors: auth setup (secret key, password hashing), theme compilation, page slug validation, widget provider init, and manifest rendering — the chained %w identifies which one.

Source

Thrown at internal/glance/main.go:170

	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)
		}

		startServer, _ := app.server()
		if err := startServer(); err != nil {
			return fmt.Errorf("starting server: %w", err)
		}
	}

	<-exitChannel
	return nil
}

func serveUpdateNoticeIfConfigLocationNotMigrated(configPath string) bool {
	if !isRunningInsideDockerContainer() {
		return false
	}

	if _, err := os.Stat(configPath); err == nil {

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Read the chained error — it names the init step (auth/theme/pages) and cause
  2. Fix that specific issue using its targeted guidance (secret key format, theme colors, page slugs)
  3. Re-run until newApplication completes; validate config before deploying to watcher-restricted environments
Defensive patterns

Strategy: try-catch

Validate before calling

null // no single pre-check; instead pre-run the targeted validations (secret key, passwords, theme, slugs) documented for errors 65-73

Try / catch

Single top-level catch around newApplication that unwraps and dispatches on the init-step prefix (auth/theme/pages/manifest) to the matching fix guidance; exit non-zero.

Prevention

When it happens

Trigger: Any of the glance.go init errors occurring while the file watcher failed to start: bad auth.secret-key, >72-byte passwords, invalid theme colors, reserved page slugs, or manifest template failures.

Common situations: Restricted runtime (no inotify) plus a config that trips one of the init validations; first launch of a newly written config where several issues coexist and the first fatal one surfaces here.

Related errors


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