{"record":{"id":"02c3acf3c2cb5fd3","repo":"Hmbown/CodeWhale","slug":"unexpected-error-detail","errorCode":null,"errorMessage":"unexpected error: {detail}","messagePattern":"unexpected error: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":19470,"sourceCode":"        let mut server = make_server(Some(&executable), &[\"server/mcp_server.py\"], None);\n        server.cwd = Some(PathBuf::from(\"/tmp/codewhale-project\"));\n        match doctor_check_mcp_server(&server) {\n            McpServerDoctorStatus::Ok(detail) => assert!(detail.contains(\"stdio\")),\n            other => panic!(\"Expected Ok when cwd anchors relative path, got {other:?}\"),\n        }\n    }\n\n    #[test]\n    fn test_self_hosted_absolute_is_ok() {\n        let executable = std::env::current_exe().expect(\"current test executable\");\n        let executable = executable.to_string_lossy();\n        let server = make_server(Some(&executable), &[\"serve\", \"--mcp\"], None);\n        match doctor_check_mcp_server(&server) {\n            McpServerDoctorStatus::Ok(detail) => assert!(detail.contains(\"stdio server\")),\n            McpServerDoctorStatus::Warning(detail) => {\n                panic!(\"Absolute path should not warn: {detail}\")\n            }\n            McpServerDoctorStatus::Error(detail) => panic!(\"unexpected error: {detail}\"),\n        }\n    }\n\n    #[cfg(test)]\n    mod mcp_auth_guidance_tests {\n        #[test]\n        fn mcp_auth_hint_is_actionable_for_connect_failures() {\n            let hint = crate::mcp::oauth::auth_required_login_hint(\"nordic-mcp\");\n            assert_eq!(\n                hint,\n                \"MCP server 'nordic-mcp' requires OAuth authentication. Run `codewhale mcp login nordic-mcp` to authenticate.\"\n            );\n        }\n    }\n\n    #[test]\n    fn test_empty_command_is_error() {\n        let server = make_server(Some(\"\"), &[], None);","sourceCodeStart":19452,"sourceCodeEnd":19488,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/tui/src/lib.rs#L19452-L19488","documentation":"Companion assertion to the previous test: after expecting Ok and rejecting Warning, the test also panics if doctor_check_mcp_server returns McpServerDoctorStatus::Error for the absolute test-executable path. It means the doctor considered a valid absolute stdio server configuration an outright error.","triggerScenarios":"doctor_check_mcp_server returns Error for a config with an absolute command path (current test binary) and args [\"serve\",\"--mcp\"].","commonSituations":"Doctor treats an unknown/absolute binary as failed spawn or unsupported transport; environment where current_exe() points somewhere unexpected; doctor validation tightened.","solutions":["Read the Error detail in the panic message to identify the doctor's failure reason.","Confirm the doctor only errors when the command genuinely cannot run (missing file, non-executable), not merely because the path is unusual.","If the doctor now errors intentionally for this shape, update the test to assert the new variant."],"exampleFix":"// before\nMcpServerDoctorStatus::Error(detail) => panic!(\"unexpected error: {detail}\"),\n// after\nMcpServerDoctorStatus::Error(detail) => panic!(\"doctor errored on valid absolute stdio server: {detail}\"),","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_error(s: &McpServerDoctorStatus) -> bool { matches!(s, McpServerDoctorStatus::Error(_)) }","tryCatchPattern":"match doctor_check_mcp_server(&server) { McpServerDoctorStatus::Error(d) => panic!(\"unexpected doctor error: {d}\"), _ => {} }","preventionTips":["Only return Error from the doctor for genuinely unusable configs (missing/unexecutable binary)","Log the doctor's decision inputs in debug builds to speed diagnosis"],"tags":["rust","test-assertion","mcp"],"backgroundTag":"unexpected-response-shape","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-22T06:17:15.046Z"}