nikivdev/code · error · anyhow::Error
No command specified
Error message
No command specified
What it means
Raised by the env-run (run-with-env) command when it is invoked without a trailing command to execute. This command fetches env vars and then spawns the given command with them injected, so an empty command list is a usage error caught before any network call.
Source
Thrown at src/env.rs:3897
// Escape for shell
let escaped = value.replace('\\', "\\\\").replace('"', "\\\"");
println!("{}=\"{}\"", key, escaped);
}
}
}
Ok(())
}
/// Run a command with env vars injected from cloud.
fn run_with_env(
personal: bool,
environment: &str,
keys: &[String],
command: &[String],
) -> Result<()> {
if command.is_empty() {
bail!("No command specified");
}
let target = if personal {
resolve_personal_target()?
} else {
resolve_env_target()?
};
let vars = fetch_env_vars(&target, environment, keys, !personal)?;
let (cmd, args) = command.split_first().unwrap();
let mut child = Command::new(cmd);
child.args(args);
// Inject env vars
for (key, value) in &vars {
child.env(key, value);
}View on GitHub (pinned to a747e741ae)
Solutions
- Append the command after `--`: `f env run --environment prod -- node server.js`.
- Quote complex commands so the whole argv reaches the runner.
- Check shell alias/wrapper isn't stripping trailing arguments.
Example fix
// before f env run --environment prod -- node // after f env run --environment prod -- node server.js
Defensive patterns
Strategy: validation
Validate before calling
# shell guard: require a command after --
args=$(...)
[ -n "$CMD" ] || { echo "usage: f env run [--env e] -- <command...>" >&2; exit 2; } Prevention
- Always separate options from the command with `--`.
- Quote commands with flags: `-- "node server.js --port 3000"` or pass as separate argv items.
- Verify wrapper scripts/aliases don't drop trailing arguments.
When it happens
Trigger: Running `f env run --personal --environment prod` (or with keys) but omitting the `-- <command>` portion, e.g. missing the `--` separator so the CLI parses no command arguments.
Common situations: Forgetting the `--` separator before the command; quotes consuming the command; copying a docs example and dropping the command part.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
- Specify a task name, --pid <pid>, or --all
- Specify a todo id or use --all to fix all open review todos
- No prompt provided. Usage: f agents run {} "your prompt here
- sessions requires a specific provider (claude or codex)
- continue requires a specific provider (claude or codex)
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/6dcc5d566279bc8e.
Report an issue: GitHub.