{"record":{"id":"df892cd849940756","repo":"Hmbown/CodeWhale","slug":"file-not-a-directory","errorCode":null,"errorMessage":"file, not a directory","messagePattern":"file, not a directory","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/config/src/tests.rs","lineNumber":4323,"sourceCode":"    let body = fs::read_to_string(&config_path).expect(\"read config\");\n    assert!(body.contains(\"# my model\"), \"prefix comment preserved\");\n    assert!(body.contains(\"# end comment\"), \"suffix comment preserved\");\n    assert!(body.contains(\"model = \\\"deepseek-v4-pro\\\"\"));\n    assert!(state_path.exists(), \"sibling setup state written\");\n}\n\n#[test]\nfn setup_transaction_rolls_back_config_store_body_on_sibling_failure() {\n    // #3410 rollback expectation: when a sibling stage fails to apply, the\n    // already-written config.toml is restored byte-for-byte, comments and\n    // all — no half-applied setup.\n    let dir = tempfile::tempdir().expect(\"tempdir\");\n    let config_path = dir.path().join(CONFIG_FILE_NAME);\n    let original = \"# my model\\nmodel = \\\"deepseek-v4-flash\\\"\\n# end comment\\n\";\n    fs::write(&config_path, original).expect(\"write config\");\n    // A parent that is a regular file makes the second stage unwritable.\n    let blocker = dir.path().join(\"blocker\");\n    fs::write(&blocker, b\"file, not a directory\").expect(\"write blocker\");\n\n    let mut store = ConfigStore::load(Some(config_path.clone())).expect(\"load config store\");\n    store.config.model = Some(\"deepseek-v4-pro\".to_string());\n\n    let mut transaction = persistence::SetupTransaction::new();\n    transaction.stage(\n        &config_path,\n        store.rendered_body().expect(\"rendered body\").into_bytes(),\n    );\n    transaction.stage(blocker.join(\"nested.json\"), b\"{}\".to_vec());\n    transaction\n        .commit()\n        .expect_err(\"commit must fail on unwritable sibling\");\n\n    let body = fs::read_to_string(&config_path).expect(\"read config\");\n    assert_eq!(body, original, \"config restored byte-for-byte on rollback\");\n}\n","sourceCodeStart":4305,"sourceCodeEnd":4341,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/config/src/tests.rs#L4305-L4341","documentation":"A test assertion message (\"file, not a directory\") used in the config setup-transaction tests: it documents the expected failure mode when the config path or a sibling stage target is occupied by a directory — the transaction should fail because a regular file was required, and the test asserts the rollback/diagnostic behavior around that failure.","triggerScenarios":"Thrown at crates/config/src/tests.rs:4323 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove or relocate the directory occupying the expected file path","Adjust the setup so the path under test is a regular file before running the transaction","If the code should tolerate this case, change the product behavior and the test expectation together, not just the test"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}