BigPizzaV3/CodexPlusPlus · error

Too many recovery records

Error message

Too many recovery records

What it means

This error is thrown during observation scans in native_browser.rs when the number of files collected under a recovery-record directory exceeds 1024. The library caps the size of the recovery-record set to bound scan cost and hash computation; more than 1024 entries signals runaway or corrupt state that should not be silently hashed.

Solutions

  1. Clean out the runtime recovery-record directory so each key holds at most 1024 files
  2. Verify runtime_root points at the intended per-session directory, not a broad data folder
  3. Fix or report the leak that keeps generating recovery records (e.g. failed runs not pruning their records)
  4. If the workload legitimately needs more records, raise the 1024 cap in the source and rebuild

Example fix

// before
ensure!(files.len() <= 1024, "Too many recovery records");
// after
if files.len() > 1024 {
    prune_oldest_recovery_files(&entry.path(), 1024)?; // trim before failing
}
ensure!(files.len() <= 1024, "Too many recovery records");
Defensive patterns

Strategy: validation

Validate before calling

const count = fs.readdirSync(runtimeRoot, {recursive:true}).length;
if (count > 1024) throw new Error(`recovery records exceed limit: ${count}`);

Type guard

const isWithinLimit = (n: number): boolean => Number.isInteger(n) && n <= 1024;

Try / catch

match monitor_once() {
    Err(e) if e.to_string().contains("Too many recovery records") => {
        prune_recovery_records(&runtime_root, 1024)?;
        retry()
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling monitor_once (or code paths like idle_observation_does_not_rewrite_control_or_reconcile that invoke the observation scan) when a runtime-key subdirectory contains more than 1024 files while key_valid(&key) passes.

Common situations: Accumulated recovery records never cleaned up across many sessions; a misconfigured runtime_root pointing at a large unrelated directory; a bug or crash loop that recreates record files without pruning old ones.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

Thrown at crates/codex-plus-core/src/native_browser.rs:925

    let plugin = paths
        .codex_home
        .join("plugins/cache/openai-bundled/unified-computer-use");
    if plugin.exists() {
        for entry in fs::read_dir(plugin)? {
            files.insert(entry?.path().join(".mcp.json"));
        }
    }
    files.insert(paths.state_root.join("control.json"));
    if paths.state_root.exists() {
        for entry in fs::read_dir(&paths.state_root)? {
            let entry = entry?;
            let key = entry.file_name().to_string_lossy().to_string();
            if key_valid(&key) {
                plain_path(&entry.path())?;
                keys.insert(key);
                for file in fs::read_dir(entry.path())? {
                    files.insert(file?.path());
                    ensure!(files.len() <= 1024, "Too many recovery records");
                }
            }
        }
    }
    for key in keys {
        let runtime = paths.runtime_root.join(key);
        files.insert(runtime.join(SERVICE));
        for (file, _) in RuntimeContract::pinned().files {
            files.insert(runtime.join(file));
        }
    }
    let mut hash = Sha256::new();
    for path in files {
        plain_path(&path)?;
        hash.update(path.to_string_lossy().as_bytes());
        if !path.exists() {
            hash.update(b"missing");
            continue;

View on GitHub (pinned to b1ed92e5e4)