{"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/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/tap_formula_metadata.rb#L13-L49","documentation":"mise's HTTP client checks the `offline` setting before every outgoing GET. When offline mode is enabled, get_async_with_headers refuses to issue any network request and throws \"offline mode is enabled\". This is an intentional guard so mise performs no network I/O when the user has opted into offline behavior.","triggerScenarios":"Calling get_async_with_headers (any HTTPClient GET) while Settings::get().offline() is true — e.g. `MISE_OFFLINE=1` or `offline = true` in settings, combined with any operation that fetches over HTTP.","commonSituations":"User left MISE_OFFLINE=1 exported in their shell and then tries to install/list tool versions; CI set offline mode for determinism but a step still needs a remote lookup.","solutions":["Unset MISE_OFFLINE or set it to a falsy value, then retry","Set `offline = false` under [settings] in mise.toml / global settings","Run `mise settings set offline false`","Pre-cache needed artifacts while online, or use already-installed tool versions"],"exampleFix":"// before\nMISE_OFFLINE=1 mise install node@22\n\n// after\nunset MISE_OFFLINE\nmise install node@22","handlingStrategy":"try-catch","validationCode":"// shell\n[ \"${MISE_OFFLINE:-0}\" = \"0\" ] || echo \"offline mode on; network GET will fail\"","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"offline mode is enabled\") => fallback_to_cached(),\n    other => other?,\n}","preventionTips":["Check `mise settings get offline` before running network-dependent commands","Don't export MISE_OFFLINE=1 in shared shell profiles","Pre-cache artifacts before enabling offline mode"],"tags":["network","offline","http"],"backgroundTag":"network-request-failed","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}