{"record":{"id":"b775a4e72389b007","repo":"BigPizzaV3/CodexPlusPlus","slug":"too-many-recovery-records","errorCode":null,"errorMessage":"Too many recovery records","messagePattern":"Too many recovery records","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/native_browser.rs","lineNumber":925,"sourceCode":"    let plugin = paths\n        .codex_home\n        .join(\"plugins/cache/openai-bundled/unified-computer-use\");\n    if plugin.exists() {\n        for entry in fs::read_dir(plugin)? {\n            files.insert(entry?.path().join(\".mcp.json\"));\n        }\n    }\n    files.insert(paths.state_root.join(\"control.json\"));\n    if paths.state_root.exists() {\n        for entry in fs::read_dir(&paths.state_root)? {\n            let entry = entry?;\n            let key = entry.file_name().to_string_lossy().to_string();\n            if key_valid(&key) {\n                plain_path(&entry.path())?;\n                keys.insert(key);\n                for file in fs::read_dir(entry.path())? {\n                    files.insert(file?.path());\n                    ensure!(files.len() <= 1024, \"Too many recovery records\");\n                }\n            }\n        }\n    }\n    for key in keys {\n        let runtime = paths.runtime_root.join(key);\n        files.insert(runtime.join(SERVICE));\n        for (file, _) in RuntimeContract::pinned().files {\n            files.insert(runtime.join(file));\n        }\n    }\n    let mut hash = Sha256::new();\n    for path in files {\n        plain_path(&path)?;\n        hash.update(path.to_string_lossy().as_bytes());\n        if !path.exists() {\n            hash.update(b\"missing\");\n            continue;","sourceCodeStart":907,"sourceCodeEnd":943,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/native_browser.rs#L907-L943","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Clean out the runtime recovery-record directory so each key holds at most 1024 files","Verify runtime_root points at the intended per-session directory, not a broad data folder","Fix or report the leak that keeps generating recovery records (e.g. failed runs not pruning their records)","If the workload legitimately needs more records, raise the 1024 cap in the source and rebuild"],"exampleFix":"// before\nensure!(files.len() <= 1024, \"Too many recovery records\");\n// after\nif files.len() > 1024 {\n    prune_oldest_recovery_files(&entry.path(), 1024)?; // trim before failing\n}\nensure!(files.len() <= 1024, \"Too many recovery records\");","handlingStrategy":"validation","validationCode":"const count = fs.readdirSync(runtimeRoot, {recursive:true}).length;\nif (count > 1024) throw new Error(`recovery records exceed limit: ${count}`);","typeGuard":"const isWithinLimit = (n: number): boolean => Number.isInteger(n) && n <= 1024;","tryCatchPattern":"match monitor_once() {\n    Err(e) if e.to_string().contains(\"Too many recovery records\") => {\n        prune_recovery_records(&runtime_root, 1024)?;\n        retry()\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Schedule periodic pruning of recovery-record directories","Monitor record counts with an alert before hitting the 1024 cap","Ensure failed sessions delete their own records on cleanup"],"tags":["filesystem","observation","limit-exceeded","recovery"],"backgroundTag":"value-out-of-range","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}