{"record":{"id":"3d7b933f4baf6359","repo":"jdx/mise","slug":"cannot-encode-value-class-as-json","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_cask_metadata.rb","lineNumber":30,"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\nCASK_FILE = ENV.fetch(\"MISE_BREW_SOURCE_PATH\")\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\",\n    high_sierra: \"10.13\", sierra: \"10.12\", el_capitan: \"10.11\"","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/tap_cask_metadata.rb#L12-L48","documentation":"Git network operations (fetch, push, ls-remote) run through a sanitized plumbing wrapper that deliberately excludes -C/--work-tree, alternate index files, and stdin. network_output() validates the incoming PlumbingCall and rejects any call that sets work_tree, index_file, or stdin, since those options only make sense for local operations and hooks on mise's own repository must not be reachable from network calls.","triggerScenarios":"Calling Git::network_output with a PlumbingCall where work_tree, index_file, or stdin is Some(_) — e.g. reusing a call struct built for a local plumbing command and passing it to the network path.","commonSituations":"Developer code refactoring shared PlumbingCall construction accidentally populating work_tree/index_file for fetch/ls-remote; piping credentials or refs via stdin to a network call that doesn't support it.","solutions":["Build a PlumbingCall with work_tree: None, index_file: None, stdin: None for network operations","Use the local plumbing executor instead if you genuinely need work tree/index/stdin","Refactor call-site code so network and local calls construct separate PlumbingCall values"],"exampleFix":"// before\nlet call = PlumbingCall { args: &[\"fetch\", \"origin\"], work_tree: Some(&repo), ..Default::default() };\ngit.network_output(call)?;\n\n// after\nlet call = PlumbingCall { args: &[\"fetch\", \"origin\"], ..Default::default() };\ngit.network_output(call)?;","handlingStrategy":"validation","validationCode":"assert!(call.work_tree.is_none() && call.index_file.is_none() && call.stdin.is_none(),\n    \"network calls must not set work_tree/index_file/stdin\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Construct distinct PlumbingCall values for local vs network git operations","Use Default::default() for network calls so optional fields stay None","Document which PlumbingCall options are network-unsafe"],"tags":["git","internal-invariant","network"],"backgroundTag":"invalid-argument-value","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"}