jdx/mise · error · TypeError

cannot encode # as JSON

Error message

cannot encode #{value.class} as JSON

What it means

err_no_task builds a list of similarly named tasks/commands and, when similar commands exist, raises "unknown command: <name>" with "Did you mean: mise <cmd_name>" suggestions. It fires when the requested task name doesn't match any defined task but resembles an existing one.

Solutions

  1. Run the suggested command shown after "Did you mean:".
  2. Run `mise tasks` to list available tasks and use the exact name.
  3. If the task exists in another directory, cd to the project root or check that its config file is loaded.

Example fix

// before
mise run biuld

// after
mise run build
Defensive patterns

Strategy: validation

Validate before calling

# Verify the task exists before invoking
mise tasks ls | grep -qx "build" && mise run build

Try / catch

// Read the 'Did you mean' suggestion from the failure output before retrying
if (result.stderr.includes('Did you mean')) {
  suggested = result.stderr.match(/mise (\S+)/)[1];
}

Prevention

When it happens

Trigger: `mise run <name>` (or task lookup via get_task_lists) where <name> matches no task and similar_cmds (fuzzy matches against known commands/tasks) is non-empty.

Common situations: Typos like `mise run biuld` for `build`; confusing a CLI subcommand with a task name (e.g. `mise run install` when you meant the `install` command); task defined in an untrusted or not-loaded config file.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/e7f4ab3e7088cb92. Report an issue: GitHub.

Appendix: source

Thrown at src/system/packages/brew/tap_formula_metadata.rb:31

    when String
      '"' + value.each_codepoint.map { |codepoint|
        case codepoint
        when 0x08 then "\\b"
        when 0x09 then "\\t"
        when 0x0a then "\\n"
        when 0x0c then "\\f"
        when 0x0d then "\\r"
        when 0x22 then '\\"'
        when 0x5c then "\\\\"
        when 0...0x20 then format("\\u%04x", codepoint)
        else codepoint.chr("UTF-8")
        end
      }.join + '"'
    when Numeric then value.to_s
    when true then "true"
    when false then "false"
    when nil then "null"
    else raise TypeError, "cannot encode #{value.class} as JSON"
    end
  end
end

FORMULA_FILE = ENV.fetch("MISE_BREW_SOURCE_PATH")
FORMULA_NAME = ENV.fetch("MISE_BREW_NAME")

module OS
  def self.mac? = ENV.fetch("MISE_BREW_OS") == "macos"
  def self.linux? = ENV.fetch("MISE_BREW_OS") == "linux"
end

class MacOSVersion
  include Comparable

  SYMBOLS = {
    tahoe: "26", sequoia: "15", sonoma: "14", ventura: "13",
    monterey: "12", big_sur: "11", catalina: "10.15", mojave: "10.14",

View on GitHub (pinned to 533346cc37)