{"record":{"id":"0588854f50bec6de","repo":"BoundaryML/baml","slug":"failed-to-clean-segmented-profiler-data-at","errorCode":null,"errorMessage":"failed to clean segmented profiler data at {}","messagePattern":"failed to clean segmented profiler data at (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_cli/src/clean_command.rs","lineNumber":50,"sourceCode":"                );\n                Ok(crate::ExitCode::Success)\n            }\n            Err(bex_events::prof::backend::CleanProfilesError::InUse) => {\n                bail!(\"profiling store is in use: {}\", profiles_root.display())\n            }\n            // Cleanup refuses any root not shaped `.../.baml/profiles-v1`,\n            // so it cannot delete an arbitrary BAML_PROFILE_DIR. Say so\n            // instead of surfacing the bare `InvalidRoot`.\n            Err(bex_events::prof::backend::CleanProfilesError::InvalidRoot)\n                if std::env::var_os(\"BAML_PROFILE_DIR\").is_some() =>\n            {\n                bail!(\n                    \"BAML_PROFILE_DIR points at {}, which is not a `.baml/profiles-v1` store; \\\n                     remove it manually\",\n                    profiles_root.display()\n                )\n            }\n            Err(error) => Err(anyhow::Error::new(error).context(format!(\n                \"failed to clean segmented profiler data at {}\",\n                profiles_root.display()\n            ))),\n        }\n    }\n}\n","sourceCodeStart":32,"sourceCodeEnd":57,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/clean_command.rs#L32-L57","documentation":"This is the contextual wrapper `baml clean` applies to any other CleanProfilesError from the profiler backend when cleaning segmented profiler data. The underlying cause (I/O error, permission problem, partial deletion failure) is attached to the context 'failed to clean segmented profiler data at <path>'.","triggerScenarios":"`baml clean` invoked on the profiles root where the backend returns an error other than InUse or InvalidRoot — e.g. filesystem permission errors, read-only mounts, or I/O failures while deleting files under `.baml/profiles-v1`.","commonSituations":"Cleaning profiles on a read-only CI workspace; directories owned by another user/container; sandboxed environments blocking deletion of profile artifacts.","solutions":["Read the chained `Caused by:` section of the error for the underlying cause.","Fix permissions on the profiles directory (chown/chmod) or run with sufficient privileges.","Delete the store manually: rm -rf .baml/profiles-v1, then re-run the command."],"exampleFix":"# before\nbaml clean  # permission denied on .baml/profiles-v1\n# after\nsudo rm -rf .baml/profiles-v1  # or fix ownership first\nbaml clean","handlingStrategy":"try-catch","validationCode":"# pre-check write access to the profiles store\n[ -w .baml/profiles-v1 ] || echo \"no write permission on .baml/profiles-v1\"","typeGuard":null,"tryCatchPattern":"try {\n  run('baml clean');\n} catch (e) {\n  if (String(e).includes('failed to clean segmented profiler data')) {\n    // inspect the 'Caused by' chain; likely permissions or read-only fs\n    fixPermissions('.baml/profiles-v1');\n    run('baml clean');\n  }\n}","preventionTips":["Ensure the workspace is writable (not a read-only mount) before cleaning","Keep .baml owned by the user running baml","Inspect the chained cause before retrying"],"tags":["cli","profiling","filesystem","cleanup"],"backgroundTag":"file-write-failed","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}