glanceapp/glance · warning

template is required

Error message

template is required

What it means

Unless hide-mountpoints-by-default is set, Glance enumerates partitions with gopsutil's disk.Partitions(false) (physical filesystems only, on Linux it parses /proc/self/mounts filtered to real fs types). Failure is wrapped as 'getting filesystems: %v' and collected; the widget then shows only explicitly configured mountpoints.

Source

Thrown at internal/glance/widget-custom-api.go:65

	compiledTemplate  *template.Template           `yaml:"-"`
	CompiledHTML      template.HTML                `yaml:"-"`
}

func (widget *customAPIWidget) initialize() error {
	widget.withTitle("Custom API").withCacheDuration(1 * time.Hour)

	if err := widget.CustomAPIRequest.initialize(); err != nil {
		return fmt.Errorf("initializing primary request: %v", err)
	}

	for key := range widget.Subrequests {
		if err := widget.Subrequests[key].initialize(); err != nil {
			return fmt.Errorf("initializing subrequest %q: %v", key, err)
		}
	}

	if widget.Template == "" {
		return errors.New("template is required")
	}

	compiledTemplate, err := template.New("").Funcs(customAPITemplateFuncs).Parse(widget.Template)
	if err != nil {
		return fmt.Errorf("parsing template: %w", err)
	}

	widget.compiledTemplate = compiledTemplate

	return nil
}

func (widget *customAPIWidget) update(ctx context.Context) {
	compiledHTML, err := fetchAndRenderCustomAPIRequest(
		widget.CustomAPIRequest, widget.Subrequests, widget.Options, widget.compiledTemplate,
	)
	if !widget.canContinueUpdateAfterHandlingErr(err) {
		return

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Check the source file directly: cat /proc/self/mounts (Linux) — if unreadable, fix procfs mounting
  2. If you only want specific mounts anyway, set hide-mountpoints-by-default: true and list mountpoints explicitly — this bypasses disk.Partitions() entirely
  3. In containers, ensure /proc is mounted read-only and not masked
  4. Inspect the wrapped gopsutil error in Glance logs for the exact cause

Example fix

// before (glance.yml)
- type: system
  # relies on auto-discovery of all partitions
// after: skip disk.Partitions() and list mounts explicitly
- type: system
  hide-mountpoints-by-default: true
  mountpoints:
    /:
      name: root
    /mnt/data:
      name: data
Defensive patterns

Strategy: validation

Validate before calling

// avoid disk.Partitions() entirely when its sources may be unavailable
if hideByDefault {
    // only explicitly configured mountpoints are queried
} else if filesystems, err := disk.Partitions(false); err != nil {
    log.Printf("filesystem enumeration failed: %v", err)
}

Prevention

When it happens

Trigger: disk.Partitions(false) errors — most commonly /proc/self/mounts (or /etc/mtab fallback) being unreadable, or on macOS/Windows the system enumeration API failing. Skipped entirely when hide-mountpoints-by-default: true.

Common situations: Containers with /proc masked or a read-only bogus /etc/mtab; chroots and minimal environments; occasionally duplicate or malformed lines in /proc/mounts after heavy bind-mount usage.

Related errors


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