{"record":{"id":"b0742b36119b65dc","repo":"Hmbown/CodeWhale","slug":"write-fixture","errorCode":null,"errorMessage":"write fixture","messagePattern":"write fixture","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/client.rs","lineNumber":8264,"sourceCode":"\n    #[test]\n    fn codex_client_uses_one_coherent_external_credential_snapshot() {\n        let _env = crate::test_support::lock_test_env();\n        let temp = tempfile::tempdir().expect(\"credential fixture\");\n        let path = temp\n            .path()\n            .canonicalize()\n            .expect(\"canonical temp root\")\n            .join(\"auth.json\");\n        let token_a = crate::test_support::future_test_jwt(\"a\");\n        std::fs::write(\n            &path,\n            serde_json::to_vec(&serde_json::json!({\n                \"tokens\": {\"access_token\": token_a.clone(), \"account_id\": \"account-a\"}\n            }))\n            .expect(\"serialize fixture\"),\n        )\n        .expect(\"write fixture\");\n        let _auth_path = crate::test_support::EnvVarGuard::set(\"OPENAI_CODEX_AUTH_FILE\", &path);\n        let _access = crate::test_support::EnvVarGuard::remove(\"OPENAI_CODEX_ACCESS_TOKEN\");\n        let _legacy_access = crate::test_support::EnvVarGuard::remove(\"CODEX_ACCESS_TOKEN\");\n        let config = Config {\n            provider: Some(ApiProvider::OpenaiCodex.as_str().to_string()),\n            providers: Some(ProvidersConfig {\n                openai_codex: ProviderConfig {\n                    auth_mode: Some(\"oauth\".to_string()),\n                    external_credentials: Some(\n                        codewhale_config::ExternalCredentialConsentToml::read_only(\n                            codewhale_config::ProviderKind::OpenaiCodex,\n                            codewhale_config::ExternalCredentialSource::CodexCli,\n                            path.clone(),\n                        ),\n                    ),\n                    ..ProviderConfig::default()\n                },\n                ..ProvidersConfig::default()","sourceCodeStart":8246,"sourceCodeEnd":8282,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/client.rs#L8246-L8282","documentation":"A panic from `std::fs::write(&path, ...).expect(\"write fixture\")` — the filesystem write of the fake Codex auth.json file failed after serialization succeeded. Common causes: the canonicalized path is unwritable, the parent directory disappeared, or permission/quota errors on the temp volume.","triggerScenarios":"`std::fs::write` to the canonicalized tempdir path in `codex_client_uses_one_coherent_external_credential_snapshot` returns Err (permissions, ENOSPC, ENOENT after cleaner sweep, read-only mount).","commonSituations":"Read-only /tmp in containers, disk full on CI, temp path deleted concurrently, or running tests as a user without write access to TMPDIR.","solutions":["Check write permissions and free space on the temp filesystem (touch $TMPDIR/probe; df -h $TMPDIR).","Re-run with a fresh TMPDIR: TMPDIR=$(mktemp -d) cargo test -p codewhale-tui.","Ensure no tmp-cleaner process deletes the directory between canonicalize and write.","In containers, mount /tmp (or $TMPDIR) as a writable tmpfs."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// rust, before writing the fixture\nassert!(path.is_file() || !path.exists());\nif let Some(dir) = path.parent() { assert!(dir.is_dir(), \"fixture parent missing\"); }","typeGuard":null,"tryCatchPattern":"std::fs::write(&path, bytes)\n    .unwrap_or_else(|e| panic!(\"write fixture {path:?}: {e}\"));","preventionTips":["Preflight writable temp volume (touch probe) in CI setup.","Mount /tmp as writable tmpfs in containers.","Avoid tmp cleaners racing with the test run."],"tags":["rust","filesystem","test-fixture","io"],"backgroundTag":"file-write-failed","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}