{"record":{"id":"f23620e7d1a481f7","repo":"nikivdev/code","slug":"source-folder-does-not-exist","errorCode":null,"errorMessage":"Source folder does not exist: {}","messagePattern":"Source folder does not exist: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/code.rs","lineNumber":282,"sourceCode":"\n/// Migrate a folder to an arbitrary target path (not necessarily ~/code).\nfn migrate_to_path(\n    from: &Path,\n    target: &Path,\n    copy: bool,\n    dry_run: bool,\n    skip_claude: bool,\n    skip_codex: bool,\n) -> Result<()> {\n    let target_display = target.display().to_string();\n    let action = if copy { \"copy\" } else { \"move\" };\n    let action_past = if copy { \"Copied\" } else { \"Moved\" };\n\n    if from == target {\n        bail!(\"Source and destination are the same path.\");\n    }\n    if !from.exists() {\n        bail!(\"Source folder does not exist: {}\", from.display());\n    }\n    if !from.is_dir() {\n        bail!(\"Source path is not a directory: {}\", from.display());\n    }\n    if target.exists() {\n        bail!(\"Destination already exists: {}\", target.display());\n    }\n    if target.starts_with(from) {\n        bail!(\"Destination cannot be inside the source folder.\");\n    }\n\n    // Create parent directories if needed\n    if let Some(parent) = target.parent() {\n        if !parent.exists() {\n            if dry_run {\n                println!(\"Would create {}\", parent.display());\n            } else {\n                fs::create_dir_all(parent)","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/code.rs#L264-L300","documentation":"Thrown by migrate_to_path (src/code.rs:282) when the source path passed to `f migrate` does not exist on disk. The command cannot copy or move a nonexistent folder, so it bails immediately after the same-path check.","triggerScenarios":"Running `f migrate <source> <target>` (or `f migrate code <relative>`) where the resolved source path — including ~/code-relative expansions — points to nothing: typo, deleted folder, wrong cwd, or a relative path that only exists on another machine.","commonSituations":"Typo in the source path; the project was already moved/renamed earlier; running from a different directory than the script assumed; paths with spaces unquoted so the shell split them.","solutions":["Verify the source exists: `ls -d <source>` and correct typos.","Quote paths containing spaces: `f migrate \"~/code/My App\" ~/code/myapp`.","Run from the correct directory or use absolute paths so relative resolution matches expectations.","If it was already moved, locate the new location (`find ~/code -maxdepth 1 -type d`) and skip or re-point the command."],"exampleFix":"// before\n$ f migrate ~/code/myap ~/dev\nError: Source folder does not exist: /home/user/code/myap\n// after\n$ f migrate ~/code/myapp ~/dev","handlingStrategy":"validation","validationCode":"// Shell: verify the source folder exists first\nSRC=\"$HOME/code/myapp\"\n[ -d \"$SRC\" ] || { echo \"source missing: $SRC\"; ls \"$HOME/code\"; exit 1; }","typeGuard":"fn source_is_movable(p: &Path) -> bool {\n    p.is_dir() // implies exists; excludes files and missing paths\n}","tryCatchPattern":"match run_migrate(opts) {\n    Err(e) if e.to_string().contains(\"Source folder does not exist\") => {\n        eprintln!(\"Check the source path (typos, spaces, wrong cwd) and retry.\");\n    }\n    other => other?,\n}","preventionTips":["Use absolute paths or verify cwd before running migrate","Quote all paths with spaces in shell scripts","Confirm the folder wasn't already moved/renamed before re-running a migration"],"tags":["file-not-found","cli","rust","argument-error"],"backgroundTag":"source-path-not-found","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}