{"record":{"id":"a8ab79b3090e00f9","repo":"Hmbown/CodeWhale","slug":"serialize-fixture","errorCode":null,"errorMessage":"serialize fixture","messagePattern":"serialize fixture","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/tui/src/client.rs","lineNumber":8262,"sourceCode":"        \"sakana-config-secret-008\",\n    ];\n\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()","sourceCodeStart":8244,"sourceCodeEnd":8280,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/client.rs#L8244-L8280","documentation":"A panic from `serde_json::to_vec(...).expect(\"serialize fixture\")` in the Codex credential-snapshot test. The test builds a JSON payload ({\"tokens\": {\"access_token\", \"account_id\"}}) via serde_json::json! and serializes it before writing auth.json. Serialization of an in-memory json! value is infallible in practice, so a failure here indicates a serde_json internal issue (or an out-of-memory condition), not bad input.","triggerScenarios":"`serde_json::to_vec(&serde_json::json!({...})).expect(\"serialize fixture\")` returns Err — practically only on allocation failure or a broken serde_json build; the value being serialized is a fixed literal shape.","commonSituations":"Running tests in a memory-limited container; a dependency upgrade that mixes incompatible serde/serde_json versions.","solutions":["Re-run the test — transient allocation failures usually disappear; check for OOM in dmesg/CI logs.","Run `cargo update -p serde_json` or `cargo check` to ensure a single consistent serde_json version in the lockfile.","If reproducible, report/inspect the exact json! literal for map-key collisions introduced by local edits.","Increase CI memory limits if the machine is near OOM."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"let bytes = serde_json::to_vec(&value)\n    .unwrap_or_else(|e| panic!(\"serialize fixture: {e}\"));","preventionTips":["Keep one serde/serde_json version in the lockfile (cargo tree -d).","Watch CI memory limits; serialization failures here usually mean OOM.","Prefer unwrap_or_else with the error payload over bare expect for diagnosability."],"tags":["rust","serde-json","serialization","test-fixture"],"backgroundTag":"json-serialization-failed","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}