jlcodes99/cockpit-tools · critical
Codex 导入因磁盘空间不足终止: label={}, imported={}, error={}
Error message
Codex 导入因磁盘空间不足终止: label={}, imported={}, error={} What it means
During import_from_files(), when upsert_account_with_hints returns an error whose message matches is_disk_full_error_message, the import is aborted for ALL remaining files: the error is logged with this message and a fatal Err('磁盘空间不足,已终止导入…') is returned. Unlike other per-account failures (which go into `failed`), disk-full is treated as terminal because subsequent writes would also fail.
Source
Thrown at src-tauri/src/modules/codex_account_mutations_quota.rs:130
serde_json::json!({
"current": progress_index,
"total": total,
"email": &label,
}),
);
}
match upsert_account_with_hints(tokens, account_id_hint, None) {
Ok(mut account) => {
if apply_auth_file_plan_type(&mut account, auth_file_plan_type) {
save_account(&account)?;
}
logger::log_info(&format!("Codex 导入成功: {}", account.email));
imported.push(account);
}
Err(e) => {
if is_disk_full_error_message(&e) {
logger::log_error(&format!(
"Codex 导入因磁盘空间不足终止: label={}, imported={}, error={}",
label,
imported.len(),
e
));
return Err(format!(
"磁盘空间不足,已终止导入(已成功 {} 个)。{}",
imported.len(),
e
));
}
logger::log_error(&format!("Codex 导入失败 {}: {}", label, e));
failed.push(CodexFileImportFailure {
email: label,
error: e,
});
}
}View on GitHub (pinned to 1ed8b77992)
Solutions
- Free disk space on the volume holding the app data directory, then re-run the import (already-imported accounts are kept).
- Check free space first (df -h on the app data path) before retrying a large batch import.
- Import in smaller batches so a full disk stops fewer accounts, and move the data directory to a larger volume if supported.
- If on a container/quota-limited FS, raise the quota rather than deleting random files.
Example fix
// before
Err(e) => {
if is_disk_full_error_message(&e) { /* abort whole import */ }
failed.push(...);
}
// after
// before retrying: ensure space
// $ df -h ~/.local/share/<app> (or app data dir)
// free space, then re-run import_from_files; already-imported accounts are preserved
Defensive patterns
Strategy: validation
Validate before calling
// Check free space on the app data volume before a bulk import (Unix): // fs4::available_space(app_data_dir)? or shell: df -h <data_dir> // abort/trim the batch if available space < expected size per account * count
Try / catch
match import_from_files(paths).await {
Ok(res) => { /* res.imported / res.failed */ }
Err(e) if e.contains("磁盘空间不足") => {
// free space, then re-run: already-imported accounts are preserved
}
Err(e) => { /* handle generic import error */ }
} Prevention
- Check available disk space before bulk imports (e.g. fs4/`df`) and warn the user when it is low.
- Import accounts in small batches so a full disk aborts less work.
- Monitor the data-directory volume; alert at a free-space threshold.
- On containers/quotas, provision adequate quota before running imports.
When it happens
Trigger: Saving an imported Codex account attempts a write while the disk (the app data volume) has insufficient free space, and the resulting error message is classified as disk-full.
Common situations: Bulk-importing many accounts on a nearly full system/app-data partition, small temp/RAM disks or containers with tight quotas, macOS/iOS data-container limits, or quota-limited network drives.
Related errors
AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05).
Data as JSON: /api/errors/1421b055c6475cab.
Report an issue: GitHub.