{"record":{"id":"e7f4ab3e7088cb92","repo":"jdx/mise","slug":"cannot-encode-value-class-as-json-e7f4ab","errorCode":null,"errorMessage":"cannot encode #{value.class} as JSON","messagePattern":"cannot encode #(.+?) as JSON","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/tap_formula_metadata.rb","lineNumber":31,"sourceCode":"    when String\n      '\"' + value.each_codepoint.map { |codepoint|\n        case codepoint\n        when 0x08 then \"\\\\b\"\n        when 0x09 then \"\\\\t\"\n        when 0x0a then \"\\\\n\"\n        when 0x0c then \"\\\\f\"\n        when 0x0d then \"\\\\r\"\n        when 0x22 then '\\\\\"'\n        when 0x5c then \"\\\\\\\\\"\n        when 0...0x20 then format(\"\\\\u%04x\", codepoint)\n        else codepoint.chr(\"UTF-8\")\n        end\n      }.join + '\"'\n    when Numeric then value.to_s\n    when true then \"true\"\n    when false then \"false\"\n    when nil then \"null\"\n    else raise TypeError, \"cannot encode #{value.class} as JSON\"\n    end\n  end\nend\n\nFORMULA_FILE = ENV.fetch(\"MISE_BREW_SOURCE_PATH\")\nFORMULA_NAME = ENV.fetch(\"MISE_BREW_NAME\")\n\nmodule OS\n  def self.mac? = ENV.fetch(\"MISE_BREW_OS\") == \"macos\"\n  def self.linux? = ENV.fetch(\"MISE_BREW_OS\") == \"linux\"\nend\n\nclass MacOSVersion\n  include Comparable\n\n  SYMBOLS = {\n    tahoe: \"26\", sequoia: \"15\", sonoma: \"14\", ventura: \"13\",\n    monterey: \"12\", big_sur: \"11\", catalina: \"10.15\", mojave: \"10.14\",","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/brew/tap_formula_metadata.rb#L13-L49","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Run the suggested command shown after \"Did you mean:\".","Run `mise tasks` to list available tasks and use the exact name.","If the task exists in another directory, cd to the project root or check that its config file is loaded."],"exampleFix":"// before\nmise run biuld\n\n// after\nmise run build","handlingStrategy":"validation","validationCode":"# Verify the task exists before invoking\nmise tasks ls | grep -qx \"build\" && mise run build","typeGuard":null,"tryCatchPattern":"// Read the 'Did you mean' suggestion from the failure output before retrying\nif (result.stderr.includes('Did you mean')) {\n  suggested = result.stderr.match(/mise (\\S+)/)[1];\n}","preventionTips":["Use tab completion for `mise run`.","Run `mise tasks` to confirm task names after refactors or renames.","Don't confuse mise subcommands (install, trust) with task names."],"tags":["tasks","cli","typo","not-found"],"backgroundTag":"command-not-found","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}