jdx/mise · error

failed to parse registry option {k} as a TOML value: {e}

Error message

failed to parse registry option {k} as a TOML value: {e}

What it means

Raised by shim_unsupported! in mise's Homebrew formula source-build shim (src/system/packages/brew/shim.rb). When mise builds a formula from source it evaluates the formula's Ruby file against a small DSL reimplementation; features the shim cannot reproduce — resource patches, custom download strategies, on_macos conditionals, inline patch strings, testpath/test blocks, and any unknown install-time helper reached through method_missing (line 857-858) — abort with ShimUnsupportedError naming the feature. Failing loudly prevents a formula from being built with silently missing patches or an unverified download strategy.

Source

Thrown at src/registry.rs:658

    pub fn ba(&self) -> Option<BackendArg> {
        self.backends()
            .first()
            .map(|f| BackendArg::new(self.short.to_string(), Some(f.to_string())))
    }

    /// Get RegistryBackend for a specific full backend string
    pub fn get_backend(&self, full: &str) -> Option<&RegistryBackend> {
        self.backends.iter().find(|rb| rb.full == full)
    }

    /// Get options for a specific backend
    pub fn backend_options(&self, full: &str) -> ToolVersionOptions {
        let mut opts = IndexMap::new();

        if let Some(backend) = self.get_backend(full) {
            for (k, v) in backend.options {
                let value = v.parse::<toml::Value>().unwrap_or_else(|e| {
                    panic!("failed to parse registry option {k} as a TOML value: {e}")
                });
                opts.insert(k.to_string(), value);
            }
        }

        ToolVersionOptions {
            opts: RawBackendOptions::from(opts),
            ..Default::default()
        }
    }

    pub(crate) fn version_order(&self, full: &str) -> Option<VersionOrder> {
        matches!(
            BackendType::guess(full),
            BackendType::Aqua
                | BackendType::Forgejo
                | BackendType::Github
                | BackendType::Gitlab

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Prefer the prebuilt bottle: install the tool via a mise backend (aqua/github/core plugin) or real `brew install <formula>` instead of source-building it
  2. Update mise to the newest release and retry — the source-build shim's DSL coverage expands each release
  3. Pin an older formula version whose definition predates the unsupported feature
  4. If you control the formula, replace the unsupported construct (drop the resource patch, use the default download strategy, remove the test block) or vendor the patch into your build config

Example fix

# before: formula feature the shim cannot build
class Foo < Formula
  resource "data" do
    url "https://example.com/data.tar.gz"
    patch { url "https://example.com/p.diff" }  # -> shim_unsupported!("resource patches")
  end
end

# after: plain resources, no custom strategy/patch
class Foo < Formula
  resource "data" do
    url "https://example.com/data.tar.gz"
    sha256 "..."
  end
end
Defensive patterns

Strategy: fallback

Validate before calling

# heuristic pre-check before mise source-builds a formula
brew cat <formula> 2>/dev/null | grep -nE 'patch|using:|testpath|on_macos|on_system' && \
  echo "formula likely unsupported by mise source-build shim -> use a bottle or real brew"

Type guard

def shim_supported_formula?(path)
  src = File.read(path)
  src.scan(/resource\s+"\w+".*?end/m).none? { |r| r.match?(/patch|using\s*:/) } &&
    !src.match?(/testpath|inline_patch|on_macos/)
end

Try / catch

begin ... rescue ShimUnsupportedError => e; warn e.message; fall back to `brew install <formula>` (bottle) or a mise backend (aqua/github) for the same tool; end — do not retry the source build.

Prevention

When it happens

Trigger: mise source-build of a formula whose Ruby definition contains: `patch` inside a resource (line 405), a resource with `using: <strategy>` (line 410), an on_system macos conditional (line 614), inline patch strings (line 659), a `testpath` call (line 718), or any helper method the shim never defined (method_missing, line 858) — e.g. `livecheck`, `fails_with`, `needs :xcode`.

Common situations: Building older/complex formulas (e.g. those carrying backported patches or custom fetch strategies); formulas upgraded upstream to use newer Homebrew DSL after your mise version; Linux users hitting `on_macos`/`on_linux` blocks in mac-centric formulas; CI source-builds of formulas that normally ship bottles.

Understand the failure class

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/8d759d7311a20515. Report an issue: GitHub.