can1357/oh-my-pi · error · Error
--alias requires a command name
Error message
--alias requires a command name
What it means
extractProfileFlags saw a bare `--alias` flag with no following command name — the next argv element is absent or begins with `-`. A managed alias must have a concrete name, so parsing aborts with this targeted error.
Source
Thrown at packages/coding-agent/src/cli/profile-bootstrap.ts:131
}
profile = value;
insertBoundaryBeforeNextValue = needsBoundaryAfterGlobalStrip(stripped);
index += 1;
continue;
}
if (arg.startsWith("--profile=")) {
const value = arg.slice("--profile=".length);
if (!value) {
throw new Error("--profile requires a profile name");
}
profile = value;
insertBoundaryBeforeNextValue = needsBoundaryAfterGlobalStrip(stripped);
continue;
}
if (arg === "--alias") {
const value = argv[index + 1];
if (!value || value.startsWith("-")) {
throw new Error("--alias requires a command name");
}
aliasName = value;
insertBoundaryBeforeNextValue = needsBoundaryAfterGlobalStrip(stripped);
index += 1;
continue;
}
if (arg.startsWith("--alias=")) {
const value = arg.slice("--alias=".length);
if (!value) {
throw new Error("--alias requires a command name");
}
aliasName = value;
insertBoundaryBeforeNextValue = needsBoundaryAfterGlobalStrip(stripped);
continue;
}
// Known string flags normally consume flag-looking values (for example
// `--system-prompt --profile foo` means the system prompt is literallyView on GitHub (pinned to 9690622007)
Solutions
- Supply the alias name: `omp --profile <name> --alias <aliasName>`
- Use `--alias=<name>` to bind the value explicitly
- Reorder flags so the alias name directly follows --alias
Example fix
// before omp --profile work --alias // after omp --profile work --alias work
Defensive patterns
Strategy: validation
Validate before calling
const i = argv.indexOf("--alias");
if (i !== -1) {
const v = argv[i + 1];
if (!v || v.startsWith("-")) throw new Error("--alias requires a name: use --alias <name> or --alias=<name>");
} Type guard
function aliasFlagHasValue(argv: string[]): boolean {
const i = argv.indexOf("--alias");
return i === -1 || (i + 1 < argv.length && !argv[i + 1].startsWith("-"));
} Try / catch
try {
await runCli(argv);
} catch (err) {
if (err instanceof Error && err.message === "--alias requires a command name") {
console.error("Usage: omp --profile <name> --alias <aliasName>");
process.exitCode = 2;
return;
}
throw err;
} Prevention
- Always give --alias a value in the same token sequence; never let a flag follow it directly
- Validate ALIAS_NAME variables are non-empty in wrapper scripts
- Prefer --alias=<name> for unambiguous binding
When it happens
Trigger: Invoking `omp --profile work --alias` (end of argv) or `omp --alias --profile work` where the token after `--alias` is another flag.
Common situations: Re-running a command from history where the alias name was lost; swapping flag order and forgetting the value; scripts with an empty alias variable followed by more flags.
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
- --alias requires a named --profile value.
- --profile requires a profile name
- unknown file type: {value}
- invalid size: {value}
- 2
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/8001aa34b97261dc.
Report an issue: GitHub.