{"record":{"id":"be36cbdf800f236a","repo":"xai-org/grok-build","slug":"error","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-pager/src/app/mod.rs","lineNumber":693,"sourceCode":"        &raw_config,\n        remote_settings.as_ref(),\n        true,\n        requested_confinement,\n    );\n    tracing::info!(\n        use_leader,\n        ?policy_disable_reason,\n        sandbox_profile = ?requested_confinement,\n        // The other fields cannot distinguish this from leader mode being off already while a sandbox is on\n        leader_disabled_by_sandbox = disabled_by_confinement.is_some(),\n        prefetch_ms = prefetch_elapsed.as_millis() as u64,\n        \"pager TUI leader mode resolved\"\n    );\n    if let Some(profile) = disabled_by_confinement {\n        warn_leader_disabled_by_sandbox(profile);\n    }\n    if session_startup::chat_mode_conflicts_with_leader(args.chat(), use_leader) {\n        anyhow::bail!(\"{}\", session_startup::CHAT_MODE_LEADER_CONFLICT);\n    }\n    if args.trust {\n        match std::env::current_dir() {\n            Ok(cwd) => xai_grok_workspace::folder_trust::grant_folder_trust(&cwd),\n            Err(e) => {\n                tracing::warn!(error = %e, \"--trust: failed to resolve cwd; folder not trusted\")\n            }\n        }\n    }\n    if let Some(reason) = policy_disable_reason {\n        tokio::spawn(xai_grok_shell::leader::kill_stale_reachable_leaders(reason));\n    }\n    if let Some(err) =\n        session_startup::chat_mode_flag_conflict(args.chat(), args.fork_session, args.restore_code)\n    {\n        anyhow::bail!(\"{err}\");\n    }\n    #[cfg(feature = \"local-workspace\")]","sourceCodeStart":675,"sourceCodeEnd":711,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/app/mod.rs#L675-L711","documentation":"The pager CLI bails when `--chat` mode is requested together with leader mode, because the two startup paths are mutually exclusive: chat mode drives a single conversational session while leader mode orchestrates subordinate sessions. The constant `session_startup::CHAT_MODE_LEADER_CONFLICT` carries the explanatory message and `anyhow::bail!` aborts startup with the formatted string `{}`.","triggerScenarios":"Running the binary with both a chat-mode flag (e.g. `--chat`) and any flag/env that enables leader mode; `session_startup::chat_mode_conflicts_with_leader(args.chat(), use_leader)` returns true and mod.rs:693 bails.","commonSituations":"Shell aliases or wrapper scripts that always pass `--chat` while the user separately enables leader mode via config or env; combining a documented chat quick-start command with an existing leader-mode setup.","solutions":["Remove the `--chat` flag when leader mode is enabled (or vice versa) so only one mode is active","Check shell aliases, wrapper scripts, and config files for a hardcoded `--chat`","Inspect the leader-mode env/flags that set `use_leader` and disable them for chat runs"],"exampleFix":"// before\ngrok-pager --chat --leader\n// after\ngrok-pager --chat        # or: grok-pager --leader (without --chat)","handlingStrategy":"validation","validationCode":"fn ensure_no_chat_leader_conflict(chat: bool, use_leader: bool) -> Result<(), String> {\n    if chat && use_leader { Err(\"--chat cannot be combined with leader mode\".into()) } else { Ok(()) }\n}","typeGuard":"fn chat_without_leader(chat: bool, use_leader: bool) -> bool { chat && !use_leader }","tryCatchPattern":"match run_pager(args) {\n    Err(e) if e.to_string().contains(\"CHAT_MODE_LEADER_CONFLICT\") || e.to_string().to_lowercase().contains(\"leader\") => eprintln!(\"Drop --chat or leader mode: {e}\"),\n    Err(e) => eprintln!(\"startup failed: {e}\"),\n    Ok(_) => {},\n}","preventionTips":["Do not hardcode --chat in shell aliases if leader mode is also configured","Grep startup scripts for both chat and leader flags before combining","Keep chat and leader invocations in separate wrapper scripts"],"tags":["cli","startup","configuration-conflict"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}