d12frosted/homebrew-emacs-plus · error · ConfigurationError

YAML syntax error in #{path} #{e.message} Tip: Validate you

Error message

YAML syntax error in #{path}
#{e.message}

Tip: Validate your YAML at https://yamlchecker.com/

What it means

BuildConfig could not parse the YAML in the file named in the message (the build.yml picked by load_config: $HOMEBREW_EMACS_PLUS_BUILD_CONFIG, ~/.config/emacs-plus/build.yml, or ~/.emacs-plus-build.yml). YAML.safe_load raised Psych::SyntaxError, and the rescue at Library/BuildConfig.rb:69-76 re-raised it as BuildConfig::ConfigurationError, embedding the parser's original message (with line and column) plus a validation-tip link. It fires before any structure validation, so a single bad character anywhere in the file aborts the whole emacs-plus install/build.

Source

Thrown at Library/BuildConfig.rb:72

        if config_file
          config = load_and_validate_yaml(config_file)
          config_source = config_file
        end
      end

      { config: config || {}, source: config_source }
    end

    # Load YAML file and validate its structure
    # Returns empty hash for empty files, raises ConfigurationError for invalid configs
    def load_and_validate_yaml(path)
      content = File.read(path)
      return {} if content.strip.empty?

      begin
        config = YAML.safe_load(content, permitted_classes: [Symbol])
      rescue Psych::SyntaxError => e
        raise ConfigurationError,
          "YAML syntax error in #{path}\n" \
          "#{e.message}\n\n" \
          "Tip: Validate your YAML at https://yamlchecker.com/"
      end

      validate_config!(config, path)
      config
    end

    # True if value is an external resource spec: {url, sha256}
    def external_spec?(value)
      value.is_a?(Hash) && !value.empty? && (value.keys.map(&:to_s) - SPEC_KEYS).empty?
    end

    # True if value is a version map: a hash keyed by major version/"default"
    def version_map?(value)
      value.is_a?(Hash) && !external_spec?(value)
    end

View on GitHub (pinned to 01c47fe98f)

Solutions

  1. Open the path shown in the message and jump to the line/column Psych reports - fix that exact spot first.
  2. Replace all tab indentation with spaces, and any smart quotes/curly characters with straight ASCII ones.
  3. Validate the file: paste it into https://yamlchecker.com/ or run `ruby -ryaml -e 'YAML.safe_load(File.read(ARGV[0]))' ~/.config/emacs-plus/build.yml` - silence means the syntax is clean.
  4. If you cannot spot it, start from an empty file (an empty file is valid and means 'no config') and re-add keys one at a time until the error reappears.

Example fix

# before (unclosed quote, tab indentation)
icon: "Spacemacs
	url: https://example.com/icns

# after (plain string, no tab needed)
icon: Spacemacs
Defensive patterns

Strategy: try-catch

Validate before calling

# Pre-parse the config exactly like BuildConfig does, before running brew
require "yaml"
path = ENV["HOMEBREW_EMACS_PLUS_BUILD_CONFIG"] || "#{Etc.getpwuid.dir}/.config/emacs-plus/build.yml"
if File.exist?(path)
  begin
    YAML.safe_load(File.read(path), permitted_classes: [Symbol])
  rescue Psych::SyntaxError => e
    abort "Fix build.yml first: #{e.message}"
  end
end

Try / catch

begin
  result = BuildConfig.load_config
rescue BuildConfig::ConfigurationError => e
  warn "build.yml rejected: #{e.message}"
  abort "Edit the file named above, validate at https://yamlchecker.com/, then retry"
end

Prevention

When it happens

Trigger: Calling BuildConfig.load_config (directly or via `brew install/reinstall emacs-plus` or the cask postflight) when the config file contains invalid YAML: tab characters used for indentation, an unclosed quote or bracket, a stray ':' or '-' placement, or a duplicate key. Any of these makes Psych::SyntaxError throw inside safe_load before validate_config! ever runs.

Common situations: Hand-editing build.yml in an editor that inserts tabs (YAML allows only spaces); pasting snippets from websites or chat UIs that introduce smart quotes, curly apostrophes, or non-breaking spaces; a truncated or half-synced file from a dotfiles manager. A comments-only file does NOT hit this (it parses to nil and triggers the mapping error instead).

Related errors


AI-assisted analysis of d12frosted/homebrew-emacs-plus@01c47fe98f (2026-08-23). Data as JSON: /api/errors/a1b30646d94cac3a. Report an issue: GitHub.