BigPizzaV3/CodexPlusPlus · error

manifest keyId 或 createdAt 无效

Error message

manifest keyId 或 createdAt 无效

What it means

validate_manifest rejects the package when the optional manifest.keyId is present but fails valid_key_id, or when manifest.createdAt is not a valid RFC 3339 timestamp per valid_rfc3339. These fields anchor the package signature and build time, so malformed values make provenance unverifiable. Thrown during validate_and_read_package.

Solutions

  1. Format createdAt as RFC 3339, e.g. "2024-06-01T12:00:00Z"
  2. If keyId is present, fix it to satisfy valid_key_id or remove it (it is optional)
  3. Generate timestamps programmatically (e.g. toISOString() in JS) instead of typing them
  4. Re-validate the package

Example fix

// before (manifest.json)
"createdAt": "2024-06-01 12:00:00",
"keyId": "k"
// after
"createdAt": "2024-06-01T12:00:00Z",
"keyId": "acme-2024-06-signing-01"
Defensive patterns

Strategy: validation

Validate before calling

fn rfc3339_ok(s: &str) -> bool {
    chrono::DateTime::parse_from_rfc3339(s).is_ok()
}
if !rfc3339_ok(&manifest.created_at) { /* fix before calling */ }
if let Some(k) = &manifest.key_id { if k.is_empty() || k.len() > 64 { /* fix or drop */ } }

Type guard

fn has_valid_timestamp_and_key(created_at: &str, key_id: Option<&str>) -> bool {
    let ts_ok = chrono::DateTime::parse_from_rfc3339(created_at).is_ok();
    let key_ok = key_id.map_or(true, |k| !k.is_empty() && k.chars().all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_'));
    ts_ok && key_ok
}

Try / catch

match validate_and_read_package(&path, platform) {
    Err(e) if e.to_string().contains("keyId 或 createdAt 无效") => {
        eprintln!("package rejected: bad keyId or non-RFC3339 createdAt");
    }
    other => other?,
}

Prevention

When it happens

Trigger: validate_and_read_package reads a manifest where keyId is set but has an invalid shape (e.g. wrong length or characters), or createdAt uses a non-RFC3339 format such as "2024-01-01 12:00:00", a date only, or a locale string.

Common situations: Hand-written timestamps using a space instead of 'T'; missing timezone offset; local-timezone formats from JS Date.toString(); truncated key ids copied from a signing tool.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/6bdc55e7cd16e458. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/dream_skin_package.rs:974

            .bytes()
            .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'_' | b'-'))
        || manifest.license.is_empty()
        || manifest.license.len() > 64
        || !manifest.license.bytes().enumerate().all(|(index, byte)| {
            byte.is_ascii_alphanumeric()
                || (index > 0 && matches!(byte, b' ' | b'.' | b'+' | b'(' | b')' | b'-'))
        })
        || !safe_manifest_text(&manifest.provenance.summary, 1, 500, true)
    {
        bail!("manifest 发布者、许可证或来源说明为空");
    }
    if manifest
        .key_id
        .as_deref()
        .is_some_and(|key| !valid_key_id(key))
        || !valid_rfc3339(&manifest.created_at)
    {
        bail!("manifest keyId 或 createdAt 无效");
    }
    if manifest.files.len() < 2 || manifest.files.len() > 8 {
        bail!("manifest.files 数量无效");
    }
    Ok(())
}

fn validate_theme(
    theme: &Value,
    manifest: &DreamSkinPackageManifest,
    image_name: &str,
) -> anyhow::Result<()> {
    let object = theme.as_object().context("theme.json 必须是对象")?;
    const REQUIRED: &[&str] = &["schemaVersion", "id", "name", "image"];
    const OPTIONAL: &[&str] = &[
        "brandSubtitle",
        "tagline",
        "projectPrefix",

View on GitHub (pinned to b1ed92e5e4)