{"record":{"id":"582d819257142cc7","repo":"d12frosted/homebrew-emacs-plus","slug":"invalid-key-in-path-expected-string-icon","errorCode":null,"errorMessage":"Invalid '#{key}' in #{path}\nExpected: string (icon name) or object with 'url' and 'sha256'\nGot: #{icon.inspect} (#{icon.class})","messagePattern":"Invalid '#(.+?)' in #(.+?)\nExpected: string \\(icon name\\) or object with 'url' and 'sha256'\nGot: #(.+?) \\(#(.+?)\\)","errorType":"validation","errorClass":"ConfigurationError","httpStatus":null,"severity":"error","filePath":"Library/BuildConfig.rb","lineNumber":243,"sourceCode":"      else\n        validate_icon_spec!(icon, path)\n      end\n    end\n\n    def validate_icon_spec!(icon, path, key: \"icon\")\n      case icon\n      when String, nil\n        # Valid: icon name from registry or no icon\n        return\n      when Hash\n        unless icon[\"url\"] && icon[\"sha256\"]\n          raise ConfigurationError,\n            \"Invalid '#{key}' configuration in #{path}\\n\" \\\n            \"When specifying an external icon, both 'url' and 'sha256' are required.\\n\" \\\n            \"Got: #{icon.inspect}\"\n        end\n      else\n        raise ConfigurationError,\n          \"Invalid '#{key}' in #{path}\\n\" \\\n          \"Expected: string (icon name) or object with 'url' and 'sha256'\\n\" \\\n          \"Got: #{icon.inspect} (#{icon.class})\"\n      end\n    end\n\n    # Validate that all keys of a version map are major versions or \"default\"\n    def validate_version_map_keys!(map, key, path)\n      bad = map.keys.reject { |k| k.to_s == \"default\" || k.to_s.match?(VERSION_KEY) }\n      return if bad.empty?\n\n      raise ConfigurationError,\n        \"Invalid '#{key}' version map in #{path}\\n\" \\\n        \"Version keys must be major Emacs versions (e.g. \\\"30\\\") or 'default'.\\n\" \\\n        \"Got key(s): #{bad.map(&:inspect).join(', ')}\"\n    end\n\n    def validate_inject_path!(value, path)","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/d12frosted/homebrew-emacs-plus/blob/01c47fe98f35ff28a37a89e1f7aafadff621f9e0/Library/BuildConfig.rb#L225-L261","documentation":"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.","triggerScenarios":"`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]}`.","commonSituations":"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.","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."],"exampleFix":"# before - array of names\nicon: [Spacemacs, Emacs-Icon]\n\n# after - one string name\nicon: Spacemacs","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"def icon_ref?(v)\n  v.is_a?(String) || v.nil? || v.is_a?(Hash)\nend\n# use on config_hash[\"icon\"], and on each per-version value when icon is a version map","tryCatchPattern":"begin\n  BuildConfig.load_config\nrescue BuildConfig::ConfigurationError => e\n  if e.message.include?(\"Expected: string (icon name)\")\n    abort \"icon must be a name string or {url, sha256} - see the Got: line in the error\"\n  end\n  raise\nend","preventionTips":["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"],"tags":["configuration","icon","type-mismatch","yaml-types","emacs-plus"],"backgroundTag":"config-type-mismatch","analyzedSha":"01c47fe98f35ff28a37a89e1f7aafadff621f9e0","analyzedAt":"2026-08-23T16:25:45.065Z","schemaVersion":2},"datasetVersion":"2026-08-23T21:17:23.414Z"}