{"record":{"id":"1421b055c6475cab","repo":"jlcodes99/cockpit-tools","slug":"codex-label-imported-error","errorCode":null,"errorMessage":"Codex 导入因磁盘空间不足终止: label={}, imported={}, error={}","messagePattern":"Codex 导入因磁盘空间不足终止: label=(.+?), imported=(.+?), error=(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src-tauri/src/modules/codex_account_mutations_quota.rs","lineNumber":130,"sourceCode":"                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(mut account) => {\n                if apply_auth_file_plan_type(&mut account, auth_file_plan_type) {\n                    save_account(&account)?;\n                }\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":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/jlcodes99/cockpit-tools/blob/1ed8b77992d62ca81fabf744deb0839ad361d5bf/src-tauri/src/modules/codex_account_mutations_quota.rs#L112-L148","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nErr(e) => {\n    if is_disk_full_error_message(&e) { /* abort whole import */ }\n    failed.push(...);\n}\n// after\n// before retrying: ensure space\n// $ df -h ~/.local/share/<app>   (or app data dir)\n// free space, then re-run import_from_files; already-imported accounts are preserved\n","handlingStrategy":"validation","validationCode":"// Check free space on the app data volume before a bulk import (Unix):\n// fs4::available_space(app_data_dir)?  or shell: df -h <data_dir>\n// abort/trim the batch if available space < expected size per account * count","typeGuard":null,"tryCatchPattern":"match import_from_files(paths).await {\n    Ok(res) => { /* res.imported / res.failed */ }\n    Err(e) if e.contains(\"磁盘空间不足\") => {\n        // free space, then re-run: already-imported accounts are preserved\n    }\n    Err(e) => { /* handle generic import error */ }\n}","preventionTips":["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."],"tags":["disk-full","file-io","import","rust"],"backgroundTag":"no-space-left-on-device","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"}