BigPizzaV3/CodexPlusPlus · warning · anyhow::Error

不支持的管理工具导航: /

Error message

不支持的管理工具导航:{}/{}

What it means

Manager navigation intents are validated against a whitelist: only page "settings" with no section or section "stepwise" is accepted. Any other page/section combination fails validation with this message embedding the offending values, preventing the frontend from navigating the manager desktop app to unknown routes.

Solutions

  1. Change the navigation intent to an allowed pair: page "settings" with section null or "stepwise"
  2. If a new page/section is intended, add it to the match arms in validate_navigation in manager_navigation.rs
  3. Verify the frontend payload field names/values match the backend enum (check App.tsx navigation emit code)

Example fix

// before
fn validate_navigation(navigation: &ManagerNavigationIntent) -> anyhow::Result<()> {
    match (navigation.page.as_str(), navigation.section.as_deref()) {
        ("settings", None | Some("stepwise")) => Ok(()),
        _ => anyhow::bail!("不支持的管理工具导航:{}/{}", navigation.page, navigation.section.as_deref().unwrap_or("")),
    }
}
// after
match (navigation.page.as_str(), navigation.section.as_deref()) {
    ("settings", None | Some("stepwise")) => Ok(()),
    ("models", None | Some("context")) => Ok(()), // newly supported page
    _ => anyhow::bail!(...),
}
Defensive patterns

Strategy: validation

Validate before calling

// frontend check before emitting intent
const ALLOWED = new Set(["settings"]);
if (!ALLOWED.has(intent.page)) throw new Error(`page ${intent.page} not navigable`);
if (intent.page === "settings" && intent.section && intent.section !== "stepwise") {
  throw new Error(`section ${intent.section} not allowed for settings`);
}

Type guard

fn is_valid_navigation(page: &str, section: Option<&str>) -> bool {
    matches!((page, section), ("settings", None | Some("stepwise")))
}

Try / catch

match manager_navigation::validate_navigation(&intent) {
    Ok(()) => save_pending(intent),
    Err(e) => {
        log::warn!("navigation rejected: {e}");
        // fall back to default settings page
        save_pending(default_settings_intent());
    }
}

Prevention

When it happens

Trigger: `validate_navigation` receives a ManagerNavigationIntent whose (page, section) pair is not ("settings", None) or ("settings", Some("stepwise")) — e.g. page "models" or section "advanced".

Common situations: Frontend emitting a stale/renamed page id; new page added to App.tsx without updating the validator whitelist; corrupted or hand-edited pending-navigation payload.

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 BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/1acab990c39e4da7. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/manager_navigation.rs:123

    };
    let pending: ManagerNavigationIntent =
        serde_json::from_str(&contents).context("管理工具导航内容无效")?;
    if pending != *navigation {
        return Ok(false);
    }
    match std::fs::remove_file(path) {
        Ok(()) => Ok(true),
        Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(false),
        Err(error) => {
            Err(error).with_context(|| format!("清理管理工具导航失败:{}", path.to_string_lossy()))
        }
    }
}

fn validate_navigation(navigation: &ManagerNavigationIntent) -> anyhow::Result<()> {
    match (navigation.page.as_str(), navigation.section.as_deref()) {
        ("settings", None | Some("stepwise")) => Ok(()),
        _ => anyhow::bail!(
            "不支持的管理工具导航:{}/{}",
            navigation.page,
            navigation.section.as_deref().unwrap_or("")
        ),
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn saves_and_consumes_stepwise_navigation_once() {
        let dir = tempfile::tempdir().unwrap();
        let path = dir.path().join("pending-manager-navigation.json");
        let navigation = ManagerNavigationIntent {
            page: "settings".to_string(),
            section: Some("stepwise".to_string()),

View on GitHub (pinned to b1ed92e5e4)