jlcodes99/cockpit-tools · critical

磁盘空间不足,已终止导入(已成功 {} 个)。{}

Error message

磁盘空间不足,已终止导入(已成功 {} 个)。{}

What it means

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.

Source

Thrown at crates/cockpit-core/src/modules/codex_account_core_mutations_quota.rs:126

            use tauri::Emitter;
            let _ = app_handle.emit(
                "codex:file-import-progress",
                serde_json::json!({
                    "current": progress_index,
                    "total": total,
                    "email": &label,
                }),
            );
        }

        match upsert_account_with_hints(tokens, account_id_hint, None) {
            Ok(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

  1. Free disk space on the drive holding the app data directory (delete logs, caches, old DB backups)
  2. Check available space with df -h (Linux/macOS) or disk properties (Windows) and ensure headroom before retrying import
  3. Move the app data directory to a larger disk if the system drive is chronically full
  4. Re-run the import after freeing space; already-imported accounts are counted in the message
Defensive patterns

Strategy: validation

Validate before calling

// before starting a batch import, ensure headroom
fn ensure_disk_headroom(path: &std::path::Path, min_free_bytes: u64) -> std::io::Result<()> {
    use std::os::unix::fs::MetadataExt;
    let st = nix::sys::statvfs::statvfs(path).map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
    if st.fragment_size() * st.blocks_available() < min_free_bytes {
        return Err(std::io::Error::new(std::io::ErrorKind::StorageFull, "insufficient disk space"));
    }
    Ok(())
}

Try / catch

match import_from_files(paths).await {
    Ok(res) => {/* use res */},
    Err(msg) if msg.contains("磁盘空间不足") => {
        // free space, then resume import; already-imported accounts are kept
    }
    Err(msg) => eprintln!("import failed: {msg}"),
}

Prevention

When it happens

Trigger: 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.

Common situations: SSD at 100% capacity; large imports on machines with small system partitions; quota-limited storage; log/database files having grown to fill the disk.

Related errors


AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05). Data as JSON: /api/errors/3eb390aa5fef97ae. Report an issue: GitHub.