{"record":{"id":"74742dcc4ad7d2f4","repo":"aaif-goose/goose","slug":"test-replay-failed-for-file-deleted","errorCode":null,"errorMessage":"Test replay failed for '{}' ({}): {}. File deleted - re-run test to record fresh data.","messagePattern":"Test replay failed for '(.+?)' \\((.+?)\\): (.+?)\\. File deleted - re-run test to record fresh data\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/goose-cli/src/scenario_tests/scenario_runner.rs","lineNumber":171,"sourceCode":"    let file_path = format!(\n        \"{}/{}/recordings/{}/{}.json\",\n        manifest_dir,\n        SCENARIO_TESTS_DIR,\n        factory_name.to_lowercase(),\n        test_name\n    );\n\n    if let Some(parent) = Path::new(&file_path).parent() {\n        std::fs::create_dir_all(parent)?;\n    }\n\n    let replay_mode = Path::new(&file_path).exists();\n    let (provider_arc, provider_for_saving, original_env) = if replay_mode {\n        match TestProvider::new_replaying(&file_path) {\n            Ok(test_provider) => (Arc::new(test_provider), None, None),\n            Err(e) => {\n                let _ = std::fs::remove_file(&file_path);\n                return Err(anyhow::anyhow!(\n                    \"Test replay failed for '{}' ({}): {}. File deleted - re-run test to record fresh data.\",\n                    test_name, factory_name, e\n                ));\n            }\n        }\n    } else {\n        if std::env::var(\"GITHUB_ACTIONS\").is_ok() {\n            panic!(\n                \"Test recording is not supported on CI. \\\n            Did you forget to add the file {} to the repository and were expecting that to replay?\",\n                file_path\n            );\n        }\n\n        let original_env = setup_environment(config)?;\n\n        let inner_provider = create(&factory_name, Vec::new()).await?;\n","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-cli/src/scenario_tests/scenario_runner.rs#L153-L189","documentation":"A recorded replay file exists for this test+provider, but TestProvider::new_replaying could not load it — typically corrupt JSON, a truncated file from an interrupted run, or a recording format that changed between goose versions. The runner deletes the broken file and tells you to re-run so it records fresh interactions (which requires real credentials).","triggerScenarios":"Upgrading goose when the on-disk recording schema changed; a test process killed mid-write leaving a partial file; a git merge conflict resolved badly inside a .recorded file.","commonSituations":"Pulling main after a replay-format migration; locally interrupted cargo test runs; CRLF conversion on Windows checkouts corrupting recording files.","solutions":["Simply re-run the test locally with valid provider credentials — it will record a fresh file; then commit the new recording.","Check `git status` / `git diff` for the deleted file and stage the replacement.","If recordings keep breaking, verify the checkout isn't rewriting line endings (.gitattributes eol settings)."],"exampleFix":"# before\n$ cargo test scenario_x\nError: Test replay failed for 'scenario_x' (openai): expected value at line 1 column 1. File deleted - re-run test to record fresh data.\n\n# after\n$ OPENAI_API_KEY=sk-... cargo test scenario_x   # re-records\n$ git add crates/goose-cli/src/scenario_tests/recordings/scenario_x.openai.recorded","handlingStrategy":"retry","validationCode":"# validate the recording is loadable JSON before running the suite\nfor f in $(git ls-files '*.recorded'); do\n    jq -e . \"$f\" >/dev/null || echo \"corrupt recording: $f\"\ndone","typeGuard":null,"tryCatchPattern":"// the runner already deletes the file; the retry IS the fix\nmatch run_scenario_test(&name).await {\n    Err(e) if e.to_string().contains(\"re-run test to record fresh data\") => {\n        record_fresh(&name).await?; // needs credentials; then commit the file\n    }\n    r => r,\n}","preventionTips":["Always commit regenerated recordings after goose version bumps.","Never interrupt a recording run mid-write; discard suspiciously small .recorded files.","Disable CRLF conversion for *.recorded via .gitattributes."],"tags":["testing","replay","recording","schema-drift","ci"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}