{"record":{"id":"626d8117c4a0409e","repo":"nikivdev/code","slug":"could-not-resolve-commit-report-directory","errorCode":null,"errorMessage":"could not resolve commit report directory","messagePattern":"could not resolve commit report directory","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/commit.rs","lineNumber":4834,"sourceCode":"        if !trimmed.is_empty() {\n            return Some(PathBuf::from(trimmed));\n        }\n    }\n    dirs::home_dir().map(|home| home.join(\".flow\").join(\"commits\"))\n}\n\nfn write_commit_review_markdown_report(\n    repo_root: &Path,\n    review: &ReviewResult,\n    reviewer: &str,\n    model_label: &str,\n    committed_sha: Option<&str>,\n    commit_message: &str,\n    review_run_id: &str,\n    review_todo_ids: &[String],\n) -> Result<PathBuf> {\n    let Some(report_dir) = flow_commit_reports_dir() else {\n        bail!(\"could not resolve commit report directory\");\n    };\n    fs::create_dir_all(&report_dir)?;\n\n    let project_name = flow_project_name(repo_root);\n    let branch = git_capture_in(repo_root, &[\"rev-parse\", \"--abbrev-ref\", \"HEAD\"])\n        .unwrap_or_else(|_| \"unknown\".to_string())\n        .trim()\n        .to_string();\n    let sha_short = committed_sha.map(short_sha).unwrap_or(\"unknown\");\n    let stamp = chrono::Utc::now().format(\"%Y%m%d_%H%M%S\").to_string();\n    let file_name = format!(\n        \"{}-{}-{}-{}.md\",\n        safe_label_value(&project_name),\n        safe_label_value(&branch),\n        sha_short,\n        stamp\n    );\n    let path = report_dir.join(file_name);","sourceCodeStart":4816,"sourceCodeEnd":4852,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/commit.rs#L4816-L4852","documentation":"Thrown when preparing the commit report directory: flow_commit_reports_dir() returned None, so the code cannot determine where to write commit/review reports. It is a configuration/environment resolution failure, before any files are written.","triggerScenarios":"Calling the commit report writer function when flow_commit_reports_dir() cannot resolve a base directory (env/config not set and no default discoverable).","commonSituations":"Running the CLI outside an initialized myflow workspace; missing or empty config entry for the reports dir; HOME/XDG env vars unset in CI or containers so the default path can't be derived.","solutions":["Set the configuration/env that flow_commit_reports_dir() reads (e.g. the myflow reports-dir setting) and rerun.","Run the command from inside an initialized project so the reports directory can be derived from the repo/workspace.","In CI, ensure HOME and XDG_CONFIG_HOME/XDG_DATA_HOME are set.","Initialize myflow config (`f auth` / project init) before committing."],"exampleFix":"// shell, before\nunset HOME  # or minimal docker env\n// after\nexport HOME=/home/user\nexport XDG_DATA_HOME=$HOME/.local/share","handlingStrategy":"validation","validationCode":"fn ensure_report_dir_ready() -> anyhow::Result<std::path::PathBuf> {\n    let dir = flow_commit_reports_dir()\n        .ok_or_else(|| anyhow::anyhow!(\"reports dir not configured; set myflow reports-dir config\"))?;\n    std::fs::create_dir_all(&dir)?;\n    Ok(dir)\n}","typeGuard":"fn reports_dir_configured() -> bool {\n    flow_commit_reports_dir().is_some()\n}","tryCatchPattern":null,"preventionTips":["Initialize myflow config/auth before committing","Set HOME/XDG vars explicitly in CI and containers","Pin the reports-dir setting in project config rather than relying on defaults","Run a config sanity check (`f doctor`-style) in CI pipelines"],"tags":["configuration","filesystem","environment"],"backgroundTag":"missing-config-value","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}