{"record":{"id":"36451744da781ce5","repo":"BigPizzaV3/CodexPlusPlus","slug":"conflicting-native-node-selection","errorCode":null,"errorMessage":"Conflicting native Node selection","messagePattern":"Conflicting native Node selection","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/native_browser.rs","lineNumber":300,"sourceCode":"        server[\"command\"]\n            .as_str()\n            .context(\"Missing native Node command\")?,\n    );\n    let relative = node\n        .strip_prefix(root)\n        .context(\"Native Node is outside the runtime cache\")?;\n    let parts: Vec<_> = relative.components().collect();\n    ensure!(parts.len() == 3, \"Unexpected native runtime layout\");\n    let key = parts[0]\n        .as_os_str()\n        .to_str()\n        .context(\"Invalid runtime key\")?;\n    ensure!(\n        key_valid(key) && relative == Path::new(key).join(\"bin/node.exe\"),\n        \"Unexpected native runtime layout\"\n    );\n    let env = &server[\"env\"];\n    ensure!(\n        env[\"NODE_REPL_NODE_PATH\"].as_str().map(Path::new) == Some(node.as_path()),\n        \"Conflicting native Node selection\"\n    );\n    let worker = root.join(key).join(\"bin/node_repl.exe\");\n    ensure!(\n        env[\"CUA_REPL_NODE_REPL_PATH\"].as_str().map(Path::new) == Some(worker.as_path()),\n        \"Conflicting native worker selection\"\n    );\n    let services: Value = serde_json::from_str(\n        env[\"NODE_REPL_TRUSTED_SERVICES\"]\n            .as_str()\n            .context(\"Missing native service map\")?,\n    )?;\n    ensure!(\n        services[\"browser\"] == \"@oai/browser-desktop/service\",\n        \"Original browser service is not selected\"\n    );\n    ensure!(","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/native_browser.rs#L282-L318","documentation":"selected_key cross-checks the descriptor's environment variables against the resolved node path: env NODE_REPL_NODE_PATH must equal the exact node command derived from the server's command field. This error is thrown when the two disagree — the descriptor nominally selects one node binary in 'command' but its environment declares a different one, so the selection is ambiguous/inconsistent and the library refuses to guess which runtime is actually in use.","triggerScenarios":"discover() -> selected_key() on a descriptor where mcpServers.cua_repl.env.NODE_REPL_NODE_PATH is missing, points to a different runtime key's node.exe, uses a non-canonical spelling (different casing, / vs \\, .. segments), or was edited independently of 'command'.","commonSituations":"Hand-edited config.toml/plugin descriptor changing only one of command/env; partially applied update that rewrote command but not env; two runtimes installed and env left pointing at the old one; path normalization differences after a drive-letter or user-profile change.","solutions":["Set env.NODE_REPL_NODE_PATH to exactly the same absolute path as mcpServers.cua_repl.command (byte-identical, normalized).","Regenerate the descriptor by reinstalling/repairing the native runtime so command and env are written consistently.","Search the descriptor for a stale key directory in NODE_REPL_NODE_PATH and update it to the currently selected runtime key.","If a symlink or case-only difference is intended, normalize both paths before comparison rather than editing one side."],"exampleFix":"// before: command and env disagree\n\"command\": \".../cua_node/rt-2/bin/node.exe\"\n\"env\": { \"NODE_REPL_NODE_PATH\": \".../cua_node/rt-1/bin/node.exe\" }\n// after: consistent selection\n\"command\": \".../cua_node/rt-2/bin/node.exe\"\n\"env\": { \"NODE_REPL_NODE_PATH\": \".../cua_node/rt-2/bin/node.exe\" }","handlingStrategy":"validation","validationCode":"let cmd = descriptor[\"mcpServers\"][\"cua_repl\"][\"command\"].as_str().unwrap();\nlet env_path = descriptor[\"mcpServers\"][\"cua_repl\"][\"env\"][\"NODE_REPL_NODE_PATH\"].as_str().unwrap_or(\"\");\nif Path::new(env_path) != Path::new(cmd) {\n    eprintln!(\"command and NODE_REPL_NODE_PATH disagree; fix before discovery\");\n}","typeGuard":"fn selection_is_consistent(server: &serde_json::Value) -> bool {\n    let cmd = server[\"command\"].as_str().map(PathBuf::from);\n    let env = server[\"env\"][\"NODE_REPL_NODE_PATH\"].as_str().map(PathBuf::from);\n    cmd.is_some() && cmd == env\n}","tryCatchPattern":"match selected_key(&descriptor, &root) {\n    Ok(key) => use_runtime(key),\n    Err(e) if e.to_string().contains(\"Conflicting native Node selection\") => {\n        fix_env_node_path(&mut descriptor)?; // set env to match command, retry\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Always update command and env.NODE_REPL_NODE_PATH together when changing runtimes","Use normalized absolute paths (no .., consistent separators) in both fields","Prefer regenerating the descriptor over manual JSON edits","After switching runtime keys, re-run the tool's status/validate command before discovery"],"tags":["rust","config-consistency","env-var","runtime-discovery"],"backgroundTag":"conflicting-config-options","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}