nikivdev/code · error

Usage: f migrate <target> OR f migrate <source> <target> OR

Error message

Usage: f migrate <target> OR f migrate <source> <target> OR f migrate code <relative>

What it means

A usage error thrown by run_migrate (src/code.rs:249) when `f migrate` is invoked with no positional arguments. The command supports three forms — migrate <target>, migrate <source> <target>, or migrate code <relative> — and none were supplied, so there is nothing to act on.

Source

Thrown at src/code.rs:249

                tgt_path
            } else {
                std::env::current_dir()?.join(&tgt_path)
            };
            (src_path, tgt_path)
        }
        // Only one path: f migrate <target> (source is cwd)
        (Some(tgt), None) => {
            let tgt_path = config::expand_path(&tgt);
            let tgt_path = if tgt_path.is_absolute() {
                tgt_path
            } else {
                std::env::current_dir()?.join(&tgt_path)
            };
            (from, tgt_path)
        }
        // No paths provided
        (None, _) => {
            bail!(
                "Usage: f migrate <target> OR f migrate <source> <target> OR f migrate code <relative>"
            );
        }
    };

    migrate_to_path(
        &from,
        &target,
        cmd.copy,
        cmd.dry_run,
        cmd.skip_claude,
        cmd.skip_codex,
    )
}

/// Migrate a folder to an arbitrary target path (not necessarily ~/code).
fn migrate_to_path(
    from: &Path,

View on GitHub (pinned to a747e741ae)

Solutions

  1. Provide a target: `f migrate <target>` to migrate the current directory.
  2. Provide both endpoints: `f migrate <source> <target>`.
  3. For code-root moves use: `f migrate code <relative>`.
  4. Run `f migrate --help` (or `f --help`) to see exact argument forms.

Example fix

// before
$ f migrate
Error: Usage: f migrate <target> OR ... OR f migrate code <relative>
// after
$ f migrate ~/code/new-home   # or: f migrate code myproject
Defensive patterns

Strategy: validation

Validate before calling

// Shell: require at least one argument before invoking migrate
[ "$#" -ge 1 ] || { echo "usage: f migrate <target> | <source> <target> | code <relative>"; exit 1; }

Try / catch

match run_migrate(opts) {
    Err(e) if e.to_string().starts_with("Usage: f migrate") => {
        eprintln!("Missing arguments — see `f migrate --help`.");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Running `f migrate` bare, or where argument parsing produced both source and target as None (e.g. piping empty args through a wrapper script).

Common situations: Forgetting arguments in shell scripts; aliasing `f migrate` expecting an interactive picker that doesn't exist; typos that swallowed arguments (e.g. unquoted empty variable).

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/6b06ff016829b847. Report an issue: GitHub.