{"record":{"id":"ddca9c5d051724e1","repo":"affaan-m/ECC","slug":"legacy-workspace-not-found","errorCode":null,"errorMessage":"Legacy workspace not found: {}","messagePattern":"Legacy workspace not found: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"ecc2/src/main.rs","lineNumber":5132,"sourceCode":"            if observation.pinned { \"/pinned\" } else { \"\" },\n            observation.entity_name\n        );\n        if let Some(session_id) = observation.session_id.as_deref() {\n            line.push_str(&format!(\" | {}\", short_session(session_id)));\n        }\n        lines.push(line);\n        lines.push(format!(\"  summary {}\", observation.summary));\n    }\n\n    lines.join(\"\\n\")\n}\n\nfn build_legacy_migration_audit_report(source: &Path) -> Result<LegacyMigrationAuditReport> {\n    let source = source\n        .canonicalize()\n        .with_context(|| format!(\"Legacy workspace not found: {}\", source.display()))?;\n    if !source.is_dir() {\n        anyhow::bail!(\n            \"Legacy workspace source must be a directory: {}\",\n            source.display()\n        );\n    }\n\n    let mut artifacts = Vec::new();\n\n    let scheduler_paths = collect_existing_relative_paths(\n        &source,\n        &[\"cron/scheduler.py\", \"jobs.py\", \"cron/jobs.json\"],\n    );\n    if !scheduler_paths.is_empty() {\n        artifacts.push(LegacyMigrationArtifact {\n            category: \"scheduler\".to_string(),\n            readiness: LegacyMigrationReadiness::ReadyNow,\n            detected_items: scheduler_paths.len(),\n            source_paths: scheduler_paths,\n            mapping: vec![","sourceCodeStart":5114,"sourceCodeEnd":5150,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/ecc2/src/main.rs#L5114-L5150","documentation":"`build_legacy_migration_audit_report` canonicalizes the given legacy workspace path before scanning artifacts. `Path::canonicalize` fails when the path does not exist, and the `with_context` wrapper attaches this message including the displayed path. The audit cannot proceed without a valid source workspace.","triggerScenarios":"Passing a nonexistent directory (or file path) to the legacy migration audit command; a typo'd path argument; a path removed between config-time and run-time.","commonSituations":"Running the migration audit on a machine where the old workspace lives at a different location; a renamed/moved legacy directory; passing a relative path from the wrong working directory; missing drive/mount on the machine running the audit.","solutions":["Verify the legacy workspace path exists (`ls <path>`) and correct the argument or config value.","Use an absolute path to avoid working-directory surprises.","Restore or re-clone the legacy workspace if it was deleted, then rerun the audit."],"exampleFix":"// before\nbuild_legacy_migration_audit_report(Path::new(\"~/old-ws\"))?;\n\n// after\nlet src = expand_tilde(\"~/old-ws\");\nassert!(src.exists(), \"legacy workspace missing: {}\", src.display());\nbuild_legacy_migration_audit_report(&src)?;","handlingStrategy":"validation","validationCode":"// Rust\nlet source = Path::new(raw_path);\nif !source.exists() {\n    anyhow::bail!(\"legacy workspace does not exist: {}\", source.display());\n}","typeGuard":"fn legacy_workspace_exists(p: &Path) -> bool {\n    p.exists()\n}","tryCatchPattern":"match build_legacy_migration_audit_report(&source) {\n    Err(e) if e.to_string().starts_with(\"Legacy workspace not found\") => {\n        eprintln!(\"Check the path: {}\", source.display());\n    }\n    other => other?,\n}","preventionTips":["Store the legacy workspace path in config once, validated at startup.","Use absolute paths and confirm mounts/drives exist before running migration tooling.","Run `ls` on the path before long migration runs to fail fast."],"tags":["filesystem","migration","rust"],"backgroundTag":"file-not-found","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}