Hmbown/CodeWhale · error

Absolute path should not warn

Error message

Absolute path should not warn: {detail}

What it means

Test panic in the MCP doctor tests: an absolute executable path (the current test binary) passed to doctor_check_mcp_server must yield Ok, never Warning. The panic fires when the doctor incorrectly emits a Warning (e.g. flagging the path as relative or unverified) for an absolute path.

Solutions

  1. Inspect the Warning detail printed in the panic to see why the doctor flagged the absolute path.
  2. Fix the branch in doctor_check_mcp_server so absolute paths (Path::is_absolute) bypass the relative-path warning.
  3. If Warning is intended for missing-file cases, ensure the path existence check passes for current_exe() in the test environment.

Example fix

// before
if !command_is_scoped_npm(pkg) { warn_about_relative_path(path) }
// after
if !Path::new(path).is_absolute() && !command_is_scoped_npm(pkg) { warn_about_relative_path(path) }
Defensive patterns

Strategy: validation

Validate before calling

debug_assert!(Path::new(&command).is_absolute(), "doctor test expects absolute command path");

Type guard

fn is_warning(s: &McpServerDoctorStatus) -> bool { matches!(s, McpServerDoctorStatus::Warning(_)) }

Try / catch

if let McpServerDoctorStatus::Warning(d) = doctor_check_mcp_server(&server) { panic!("absolute path warned: {d}"); }

Prevention

When it happens

Trigger: doctor_check_mcp_server returns McpServerDoctorStatus::Warning for a config whose command is an absolute path (std::env::current_exe()).

Common situations: A doctor change made absolute paths go through the relative-path warning branch; path classification regex/inversion bug; path canonicalization failure on the test executable.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/775bfd4634b7191d. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/lib.rs:19468

        let executable = std::env::current_exe().expect("current test executable");
        let executable = executable.to_string_lossy();
        let mut server = make_server(Some(&executable), &["server/mcp_server.py"], None);
        server.cwd = Some(PathBuf::from("/tmp/codewhale-project"));
        match doctor_check_mcp_server(&server) {
            McpServerDoctorStatus::Ok(detail) => assert!(detail.contains("stdio")),
            other => panic!("Expected Ok when cwd anchors relative path, got {other:?}"),
        }
    }

    #[test]
    fn test_self_hosted_absolute_is_ok() {
        let executable = std::env::current_exe().expect("current test executable");
        let executable = executable.to_string_lossy();
        let server = make_server(Some(&executable), &["serve", "--mcp"], None);
        match doctor_check_mcp_server(&server) {
            McpServerDoctorStatus::Ok(detail) => assert!(detail.contains("stdio server")),
            McpServerDoctorStatus::Warning(detail) => {
                panic!("Absolute path should not warn: {detail}")
            }
            McpServerDoctorStatus::Error(detail) => panic!("unexpected error: {detail}"),
        }
    }

    #[cfg(test)]
    mod mcp_auth_guidance_tests {
        #[test]
        fn mcp_auth_hint_is_actionable_for_connect_failures() {
            let hint = crate::mcp::oauth::auth_required_login_hint("nordic-mcp");
            assert_eq!(
                hint,
                "MCP server 'nordic-mcp' requires OAuth authentication. Run `codewhale mcp login nordic-mcp` to authenticate."
            );
        }
    }

    #[test]

View on GitHub (pinned to 433685b202)