{"record":{"id":"512bdca550d36680","repo":"vectordotdev/vector","slug":"failed-to-run-cleanup-command-e","errorCode":null,"errorMessage":"Failed to run cleanup command: {e}","messagePattern":"Failed to run cleanup command: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/compose_tests/run.rs","lineNumber":131,"sourceCode":"}\n\n/// Clean up previous test output from the docker volume\nfn cleanup_test_output(test_name: &str) -> Result<()> {\n    debug!(\"Cleaning up previous test output for '{test_name}'\");\n\n    let status = Command::new(CONTAINER_TOOL.clone())\n        .args([\n            \"run\",\n            \"--rm\",\n            \"-v\",\n            &format!(\"vector_target:/output/{test_name}\"),\n            \"alpine:3.20\",\n            \"sh\",\n            \"-c\",\n            &format!(\"rm -rf /output/{test_name}/*\"),\n        ])\n        .status()\n        .map_err(|e| anyhow::anyhow!(\"Failed to run cleanup command: {e}\"))?;\n\n    if !status.success() {\n        warn!(\"Failed to clean up previous test output (this may be okay if it didn't exist)\");\n    }\n\n    Ok(())\n}\n\n/// Upload test results to Datadog (in CI only, no-op locally)\n///\n/// The script itself checks for CI environment and handles the logic.\nfn upload_test_results() {\n    let result = Command::script(\"upload-test-results.sh\").status();\n\n    match result {\n        Ok(status) if !status.success() => {\n            warn!(\"Upload script exited with non-zero status\");\n        }","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/compose_tests/run.rs#L113-L149","documentation":"Compose test cleanup spawns `docker run alpine:3.20 sh -c \"rm -rf /output/<test>/*\"`. If the docker process cannot be spawned at all (the `status()` call errors), `cleanup_test_output` wraps the io::Error in this anyhow message. A nonzero exit only produces a warning, not this error.","triggerScenarios":"`docker` binary is missing from PATH; the Docker daemon is unreachable such that the client errors; volume/mount flags are invalid; OS-level permission failures prevent spawning the command.","commonSituations":"Running compose tests on a machine without Docker installed or with the daemon not running; PATH differs in CI; stale docker context pointing at a dead remote host.","solutions":["Install/start Docker and confirm `docker run alpine:3.20 echo ok` works before running compose tests.","Check that `docker` is on PATH in the environment running vdev.","Note the previous run's output may remain: the failure is the spawn, but cleanup failures on exit status are only warnings — rerun after fixing Docker."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import { execFileSync } from 'child_process';\ntry { execFileSync('docker', ['info'], { stdio: 'ignore' }); } catch {\n  throw new Error('Docker is not available; compose test cleanup will fail');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runCleanup();\n} catch (e) {\n  if (/Failed to run cleanup command/.test(String(e))) {\n    // Docker unavailable: warn and continue, previous output may remain\n    console.warn('Skipping compose output cleanup:', e.message);\n  } else throw e;\n}","preventionTips":["Verify Docker is installed and the daemon is running before running compose tests.","Ensure `docker` is on PATH in CI and local shells.","Treat cleanup spawn failures as environment problems, not test failures."],"tags":["docker","command-execution","cleanup"],"backgroundTag":"command-not-found","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}