nikivdev/code · error
Source folder does not exist: {}
Error message
Source folder does not exist: {} What it means
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.
Source
Thrown at src/code.rs:282
/// Migrate a folder to an arbitrary target path (not necessarily ~/code).
fn migrate_to_path(
from: &Path,
target: &Path,
copy: bool,
dry_run: bool,
skip_claude: bool,
skip_codex: bool,
) -> Result<()> {
let target_display = target.display().to_string();
let action = if copy { "copy" } else { "move" };
let action_past = if copy { "Copied" } else { "Moved" };
if from == target {
bail!("Source and destination are the same path.");
}
if !from.exists() {
bail!("Source folder does not exist: {}", from.display());
}
if !from.is_dir() {
bail!("Source path is not a directory: {}", from.display());
}
if target.exists() {
bail!("Destination already exists: {}", target.display());
}
if target.starts_with(from) {
bail!("Destination cannot be inside the source folder.");
}
// Create parent directories if needed
if let Some(parent) = target.parent() {
if !parent.exists() {
if dry_run {
println!("Would create {}", parent.display());
} else {
fs::create_dir_all(parent)View on GitHub (pinned to a747e741ae)
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.
Example fix
// before $ f migrate ~/code/myap ~/dev Error: Source folder does not exist: /home/user/code/myap // after $ f migrate ~/code/myapp ~/dev
Defensive patterns
Strategy: validation
Validate before calling
// Shell: verify the source folder exists first
SRC="$HOME/code/myapp"
[ -d "$SRC" ] || { echo "source missing: $SRC"; ls "$HOME/code"; exit 1; } Type guard
fn source_is_movable(p: &Path) -> bool {
p.is_dir() // implies exists; excludes files and missing paths
} Try / catch
match run_migrate(opts) {
Err(e) if e.to_string().contains("Source folder does not exist") => {
eprintln!("Check the source path (typos, spaces, wrong cwd) and retry.");
}
other => other?,
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Template not found: {}
- Diff bundle not found. Expected {} or pass a path to a bundl
- Template path is not a directory: {}
- Usage: f migrate <target> OR f migrate <source> <target> OR
- Could not find agent file for '{}'
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/f23620e7d1a481f7.
Report an issue: GitHub.