{"record":{"id":"3eb390aa5fef97ae","repo":"jlcodes99/cockpit-tools","slug":"error-3eb390","errorCode":null,"errorMessage":"磁盘空间不足，已终止导入（已成功 {} 个）。{}","messagePattern":"磁盘空间不足，已终止导入（已成功 (.+?) 个）。(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/cockpit-core/src/modules/codex_account_core_mutations_quota.rs","lineNumber":126,"sourceCode":"            use tauri::Emitter;\n            let _ = app_handle.emit(\n                \"codex:file-import-progress\",\n                serde_json::json!({\n                    \"current\": progress_index,\n                    \"total\": total,\n                    \"email\": &label,\n                }),\n            );\n        }\n\n        match upsert_account_with_hints(tokens, account_id_hint, None) {\n            Ok(account) => {\n                logger::log_info(&format!(\"Codex 导入成功: {}\", account.email));\n                imported.push(account);\n            }\n            Err(e) => {\n                if is_disk_full_error_message(&e) {\n                    logger::log_error(&format!(\n                        \"Codex 导入因磁盘空间不足终止: label={}, imported={}, error={}\",\n                        label,\n                        imported.len(),\n                        e\n                    ));\n                    return Err(format!(\n                        \"磁盘空间不足，已终止导入（已成功 {} 个）。{}\",\n                        imported.len(),\n                        e\n                    ));\n                }\n                logger::log_error(&format!(\"Codex 导入失败 {}: {}\", label, e));\n                failed.push(CodexFileImportFailure {\n                    email: label,\n                    error: e,\n                });\n            }\n        }","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/jlcodes99/cockpit-tools/blob/1ed8b77992d62ca81fabf744deb0839ad361d5bf/crates/cockpit-core/src/modules/codex_account_core_mutations_quota.rs#L108-L144","documentation":"During import_from_files, when upserting a candidate account fails and the error text matches is_disk_full_error_message, the entire import is aborted early with this message reporting how many accounts had already been successfully imported. Unlike per-file failures (which are collected), disk-full is treated as fatal because every subsequent write would also fail.","triggerScenarios":"Running import_from_files while the disk holding the app's data directory is full or nearly full, and upsert_account_with_hints fails with an ENOSPC/no-space error for candidate (old-rule) accounts.","commonSituations":"SSD at 100% capacity; large imports on machines with small system partitions; quota-limited storage; log/database files having grown to fill the disk.","solutions":["Free disk space on the drive holding the app data directory (delete logs, caches, old DB backups)","Check available space with df -h (Linux/macOS) or disk properties (Windows) and ensure headroom before retrying import","Move the app data directory to a larger disk if the system drive is chronically full","Re-run the import after freeing space; already-imported accounts are counted in the message"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before starting a batch import, ensure headroom\nfn ensure_disk_headroom(path: &std::path::Path, min_free_bytes: u64) -> std::io::Result<()> {\n    use std::os::unix::fs::MetadataExt;\n    let st = nix::sys::statvfs::statvfs(path).map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;\n    if st.fragment_size() * st.blocks_available() < min_free_bytes {\n        return Err(std::io::Error::new(std::io::ErrorKind::StorageFull, \"insufficient disk space\"));\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"match import_from_files(paths).await {\n    Ok(res) => {/* use res */},\n    Err(msg) if msg.contains(\"磁盘空间不足\") => {\n        // free space, then resume import; already-imported accounts are kept\n    }\n    Err(msg) => eprintln!(\"import failed: {msg}\"),\n}","preventionTips":["Check free disk space before large batch imports","Set up disk-usage alerts before hitting 100%","Rotate/prune logs and database backups regularly","Store app data on a volume with adequate headroom"],"tags":["disk-full","filesystem","import","codex"],"backgroundTag":"disk-full-enospc","analyzedSha":"1ed8b77992d62ca81fabf744deb0839ad361d5bf","analyzedAt":"2026-09-05T09:51:41.178Z","contentChangedAt":"2026-09-05T09:51:41.178Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}