{"record":{"id":"8740bf31e9f47322","repo":"openai/codex","slug":"unsupported-platform-platform-arch","errorCode":null,"errorMessage":"Unsupported platform: ${platform} (${arch})","messagePattern":"Unsupported platform: (.+?) \\((.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"codex-cli/bin/codex.js","lineNumber":71,"sourceCode":"    break;\n  case \"win32\":\n    switch (arch) {\n      case \"x64\":\n        targetTriple = \"x86_64-pc-windows-msvc\";\n        break;\n      case \"arm64\":\n        targetTriple = \"aarch64-pc-windows-msvc\";\n        break;\n      default:\n        break;\n    }\n    break;\n  default:\n    break;\n}\n\nif (!targetTriple) {\n  throw new Error(`Unsupported platform: ${platform} (${arch})`);\n}\n\nconst platformPackage = PLATFORM_PACKAGE_BY_TARGET[targetTriple];\nif (!platformPackage) {\n  throw new Error(`Unsupported target triple: ${targetTriple}`);\n}\n\nfunction findCodexExecutable() {\n  let vendorRoot;\n  try {\n    const packageJsonPath = require.resolve(`${platformPackage}/package.json`);\n    vendorRoot = path.join(path.dirname(packageJsonPath), \"vendor\");\n  } catch {\n    vendorRoot = path.join(__dirname, \"..\", \"vendor\");\n  }\n\n  const codexExecutable = path.join(\n    vendorRoot,","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-cli/bin/codex.js#L53-L89","documentation":"Thrown while validating a MITM hook's match.query map: a query-parameter key normalized to the empty string. The network proxy validates every network.mitm_hooks entry when config is loaded, and each query key names a concrete query parameter the hook matches, so an empty key cannot mean anything. This particular branch is defensive in practice: normalize_query_name (mitm_hook.rs:581) runs first and rejects an empty name with the identical message, so that site is what you will actually see fire.","triggerScenarios":"A config.toml [network] block with mitm = true whose mitm_hooks entry has a match.query map containing an empty key, e.g. query = { \"\" = [\"30\"] } (TOML allows a quoted empty key), or a programmatically built MitmHookMatchConfig whose BTreeMap received an empty-string key. validate_mitm_hook_config iterates the map and fails on that key.","commonSituations":"Template- or script-generated TOML where a placeholder key was never substituted; hand edits that delete a key's name but leave the entry; Rust code inserting computed keys where the computation returned an empty string.","solutions":["Delete the empty-string key from the hook's match.query map","If the entry was meant to constrain a real parameter, restore the name: query = { per_page = [\"30\"] }","If you build MitmHookConfig in Rust, drop empty keys before serializing: hook.matcher.query.retain(|k, _| !k.is_empty())"],"exampleFix":"// config.toml — before\n[network]\nmitm = true\n\n[[network.mitm_hooks]]\nhost = \"api.github.com\"\n[network.mitm_hooks.match.query]\n\"\" = [\"30\"]\n\n// after\n[network]\nmitm = true\n\n[[network.mitm_hooks]]\nhost = \"api.github.com\"\n[network.mitm_hooks.match.query]\nper_page = [\"30\"]","handlingStrategy":"validation","validationCode":"for hook in &config.mitm_hooks {\n    for key in hook.matcher.query.keys() {\n        if key.is_empty() {\n            return Err(anyhow!(\"hook for {} has an empty query key\", hook.host));\n        }\n    }\n}\nvalidate_mitm_hook_config(&config)?;","typeGuard":"fn query_keys_valid(hook: &MitmHookConfig) -> bool {\n    hook.matcher.query.keys().all(|k| !k.is_empty())\n}","tryCatchPattern":"match validate_mitm_hook_config(&config) {\n    Ok(()) => {}\n    Err(err) if err.to_string().contains(\"query keys must not be empty\") => { /* strip offending keys, re-validate */ }\n    Err(err) => return Err(err),\n}","preventionTips":["Run validate_mitm_hook_config on deserialized config in tests and CI before deploy","Lint generated TOML for quoted empty keys (\"\" = ...)","Build query maps from typed parameters instead of free-form strings"],"tags":["rust","network-proxy","mitm-hooks","query-string","config-validation","toml"],"backgroundTag":"config-validation-failed","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}