BigPizzaV3/CodexPlusPlus · error

无效的主题市场相对路径

Error message

无效的主题市场相对路径

What it means

Validation guard in validate_market_path: the relative asset path is empty, longer than 256 bytes, starts with '/', contains a backslash, or otherwise violates the relative-path rules (e.g. contains '..' segments). Paths become URLs and file names, so malformed ones are rejected early.

Source

Thrown at crates/codex-plus-core/src/dream_skin_market.rs:350

fn market_asset_url(base_url: &str, relative: &str) -> anyhow::Result<String> {
    validate_market_path(relative)?;
    let base = reqwest::Url::parse(base_url).context("主题市场基础地址无效")?;
    let joined = base.join(relative).context("主题市场资源地址无效")?;
    if joined.scheme() != base.scheme() || joined.host_str() != base.host_str() {
        bail!("主题市场资源地址越界");
    }
    Ok(joined.to_string())
}

fn validate_market_path(value: &str) -> anyhow::Result<()> {
    if value.is_empty()
        || value.len() > 256
        || value.starts_with('/')
        || value.contains('\\')
        || value.contains(['?', '#', '\0'])
    {
        bail!("无效的主题市场相对路径");
    }
    for segment in value.split('/') {
        if segment.is_empty()
            || matches!(segment, "." | "..")
            || !segment
                .bytes()
                .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'-' | b'_' | b'.'))
        {
            bail!("无效的主题市场相对路径");
        }
    }
    Ok(())
}

fn valid_theme_id(value: &str) -> bool {
    let bytes = value.as_bytes();
    (1..=64).contains(&bytes.len())
        && bytes[0].is_ascii_alphanumeric()

View on GitHub (pinned to f2074595a2)

Solutions

  1. Use a simple relative path (no leading slash, no backslashes, no '..')
  2. Shorten the path to <=256 bytes
  3. Fix the offending manifest field
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/codex-plus-core/src/dream_skin_market.rs:350 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@f2074595a2 (2026-08-23). Data as JSON: /api/errors/8564659ca48df6b0. Report an issue: GitHub.