d12frosted/homebrew-emacs-plus · error · ConfigurationError
Invalid '#{key}' in #{path} Expected: string (icon name) or
Error message
Invalid '#{key}' in #{path}
Expected: string (icon name) or object with 'url' and 'sha256'
Got: #{icon.inspect} (#{icon.class}) What it means
The icon entry (top-level `icon`, or an `icon.<version>` value inside a version map) has a type the validator does not accept: the `else` branch of validate_icon_spec! (Library/BuildConfig.rb:242-247) allows only String (registry icon name), nil, or Hash ({url, sha256}). Everything else - Array, Integer, Float, TrueClass/FalseClass - is rejected with the value's inspect output and its class in the message.
Source
Thrown at Library/BuildConfig.rb:243
else
validate_icon_spec!(icon, path)
end
end
def validate_icon_spec!(icon, path, key: "icon")
case icon
when String, nil
# Valid: icon name from registry or no icon
return
when Hash
unless icon["url"] && icon["sha256"]
raise ConfigurationError,
"Invalid '#{key}' configuration in #{path}\n" \
"When specifying an external icon, both 'url' and 'sha256' are required.\n" \
"Got: #{icon.inspect}"
end
else
raise ConfigurationError,
"Invalid '#{key}' in #{path}\n" \
"Expected: string (icon name) or object with 'url' and 'sha256'\n" \
"Got: #{icon.inspect} (#{icon.class})"
end
end
# Validate that all keys of a version map are major versions or "default"
def validate_version_map_keys!(map, key, path)
bad = map.keys.reject { |k| k.to_s == "default" || k.to_s.match?(VERSION_KEY) }
return if bad.empty?
raise ConfigurationError,
"Invalid '#{key}' version map in #{path}\n" \
"Version keys must be major Emacs versions (e.g. \"30\") or 'default'.\n" \
"Got key(s): #{bad.map(&:inspect).join(', ')}"
end
def validate_inject_path!(value, path)View on GitHub (pinned to 01c47fe98f)
Solutions
- Use one of the two accepted shapes: a single string icon name, or an external spec hash with url and sha256.
- Remove list/bracket syntax - arrays are never valid for icon.
- Quote values YAML would otherwise type as numbers or booleans ("30", "true", "no") so they stay strings.
- If the entry was a mistake, delete the icon key - it is optional.
Example fix
# before - array of names icon: [Spacemacs, Emacs-Icon] # after - one string name icon: Spacemacs
Defensive patterns
Strategy: type-guard
Type guard
def icon_ref?(v) v.is_a?(String) || v.nil? || v.is_a?(Hash) end # use on config_hash["icon"], and on each per-version value when icon is a version map
Try / catch
begin
BuildConfig.load_config
rescue BuildConfig::ConfigurationError => e
if e.message.include?("Expected: string (icon name)")
abort "icon must be a name string or {url, sha256} - see the Got: line in the error"
end
raise
end Prevention
- Never use YAML lists for icon - exactly one value per entry
- Quote anything that could parse as a number or boolean ("30", "true", "no")
- Check types with icon_ref? in any tooling that generates build.yml programmatically
- Remember YAML implicit typing: yes/no/on/off and bare numbers all become non-strings unless quoted
When it happens
Trigger: `icon: [Spacemacs, Emacs-Icon]` (YAML list), `icon: 42`, `icon: 3.14`, `icon: true` / `icon: yes`; or the same wrong types as values inside a version map, e.g. `icon: {"30": [a]}`.
Common situations: Trying to list several candidate icons; unquoted values that YAML implicitly types as numbers or booleans (a name like `30` or `no` becomes Integer/FalseClass unless quoted); copying JSON-ish config where brackets were fine.
Related errors
- Invalid build.yml at #{path} Expected a YAML mapping (key: v
- Invalid 'icon.#{ver}' in #{path} Version maps cannot be nest
- Invalid '#{key}' configuration in #{path} When specifying an
- YAML syntax error in #{path} #{e.message} Tip: Validate you
- Unknown configuration key(s) in #{path}: #{unknown_keys.join
AI-assisted analysis of d12frosted/homebrew-emacs-plus@01c47fe98f (2026-08-23).
Data as JSON: /api/errors/582d819257142cc7.
Report an issue: GitHub.