glanceapp/glance · error

orderedMap: decoding value: %v

Error message

orderedMap: decoding value: %v

What it means

The orderedYAMLMap unmarshaler failed while decoding a mapping value into the generic value type V. The value node did not match the expected structure for that entry — e.g. a scalar where a mapping was expected, a bad number, or a nested field with a wrong type. The underlying go-yaml error is chained via %v.

Source

Thrown at internal/glance/config.go:629

	om.keys = make([]K, len(node.Content)/2)
	om.data = make(map[K]V, len(node.Content)/2)

	for i := 0; i < len(node.Content); i += 2 {
		keyNode := node.Content[i]
		valueNode := node.Content[i+1]

		var key K
		if err := keyNode.Decode(&key); err != nil {
			return fmt.Errorf("orderedMap: decoding key: %v", err)
		}

		if _, ok := om.data[key]; ok {
			return fmt.Errorf("orderedMap: duplicate key %v", key)
		}

		var value V
		if err := valueNode.Decode(&value); err != nil {
			return fmt.Errorf("orderedMap: decoding value: %v", err)
		}

		(*om).keys[i/2] = key
		(*om).data[key] = value
	}

	return nil
}

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Read the chained go-yaml error for the exact field and line, then correct the value's type or structure
  2. Compare the value block against the glance config documentation for that key
  3. If the schema changed after an upgrade, migrate the config to the new format

Example fix

# before
theme:
  presets:
    my-theme: dark
# after
theme:
  presets:
    my-theme:
      color-scheme: dark
Defensive patterns

Strategy: validation

Validate before calling

// Optional: strict-decode a copy of config to surface value type errors with line info
var probe struct{ Theme struct{ Presets yaml.Node `yaml:"presets"` } `yaml:"theme"` }
if err := yaml.Unmarshal(cfg, &probe); err != nil { return err }
// then inspect each preset value node Kind == yaml.MappingNode

Try / catch

Catch and rethrow with the glance config path prepended; the chained go-yaml error already contains line/column for the bad value.

Prevention

When it happens

Trigger: A theme preset value that is a plain string instead of a properties mapping; a numeric field receiving a non-numeric scalar; any orderedYAMLMap value whose YAML node kind or scalar type is incompatible with the Go struct.

Common situations: Writing `presets: dark` instead of a nested mapping; typos in nested fields; version upgrades that changed the value schema of a config key; using quotes/strings where floats are expected.

Related errors


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