can1357/oh-my-pi · error · Error
Invalid alias "omp". Refusing to shadow the base omp command
Error message
Invalid alias "omp". Refusing to shadow the base omp command.
What it means
validateAliasName rejects the alias name "omp" (case-insensitive) because installing a shell alias with that name would shadow the base omp CLI command itself, breaking invocation of the unaliased tool. The check runs after the ALIAS_NAME_RE format check and before the shell-reserved-word check. It exists so a user can never accidentally make `omp` in their shell resolve back into a profile-wrapped alias recursively.
Source
Thrown at packages/coding-agent/src/cli/profile-alias.ts:158
switch (shell) {
case "bash":
case "zsh":
return POSIX_RESERVED_ALIAS_NAMES;
case "fish":
return FISH_RESERVED_ALIAS_NAMES;
case "powershell":
case "pwsh":
return POWERSHELL_RESERVED_ALIAS_NAMES;
}
}
function validateAliasName(aliasName: string, shell: ProfileAliasShell): string {
const normalized = aliasName.trim();
if (!ALIAS_NAME_RE.test(normalized)) {
throw new Error(`Invalid alias "${aliasName}". Alias names must match ${ALIAS_NAME_RE.source}.`);
}
if (normalized.toLowerCase() === "omp") {
throw new Error('Invalid alias "omp". Refusing to shadow the base omp command.');
}
if (getReservedAliasNames(shell).has(normalized.toLowerCase())) {
throw new Error(`Invalid alias "${aliasName}". Refusing to create a ${shell} reserved word.`);
}
return normalized;
}
// On Windows the launching shell is rarely exported through $SHELL, so when it
// is missing we infer the PowerShell edition from the inherited environment.
// PowerShell 7 (pwsh) always seeds PSModulePath with separator-delimited
// ".../PowerShell/..." module directories (plus the Windows PowerShell ones for
// back-compat), whereas Windows PowerShell 5.1 only ever lists
// ".../WindowsPowerShell/...". The separator anchors keep "WindowsPowerShell"
// from matching. POWERSHELL_DISTRIBUTION_CHANNEL is set only by some pwsh
// distributions, so it stays a secondary hint rather than the primary signal.
function detectWindowsPowerShell(env: NodeJS.ProcessEnv): ProfileAliasShell {
const modulePath = env.PSModulePath ?? env.PSMODULEPATH ?? env.psmodulepath ?? "";
if (/[\\/]PowerShell[\\/]/i.test(modulePath)) return "pwsh";View on GitHub (pinned to 9690622007)
Solutions
- Choose a different alias name that is not "omp" (case-insensitive), e.g. `--alias omp-work`
- Call the base command explicitly with --profile when you want that profile instead of installing an alias named omp
- If you truly need a bare `omp` wrapper, use a shell function with a different internal resolution rather than the managed alias installer
Example fix
// before omp --profile work --alias omp // after omp --profile work --alias omp-work
Defensive patterns
Strategy: validation
Validate before calling
const name = aliasName.trim();
if (name.toLowerCase() === "omp") throw new Error(`Alias "${aliasName}" would shadow the base omp command; pick another name`); Type guard
function isSafeAliasName(name: string): boolean {
return name.trim().toLowerCase() !== "omp";
} Try / catch
try {
await installProfileAlias({ profile, aliasName });
} catch (err) {
if (err instanceof Error && err.message.includes('Refusing to shadow the base omp command')) {
console.error(`Alias "${aliasName}" is reserved; choose a different name.`);
process.exitCode = 2;
return;
}
throw err;
} Prevention
- Never pass "omp" (any casing) as an alias name; treat it as reserved
- Validate generated alias names against a deny-list containing "omp" plus shell reserved words
- Prefer suffixed names like omp-<profile> or <profile>-omp when wrapping the default command
When it happens
Trigger: Running `omp --profile <name> --alias omp` (or `--alias=OMP` / any casing) to install a profile alias whose name is exactly "omp".
Common situations: Users who want every omp invocation to use a profile assume the alias should just be named `omp` and try to overwrite the launcher with itself; shell completion or docs suggesting `alias omp=...` copied into the --alias flag.
Related errors
- Invalid alias "${aliasName}". Alias names must match ${ALIAS
- Invalid alias "${aliasName}". Refusing to create a ${shell}
- invalid {} argument: {}
- invalid Zero increment value: {}
- --agents must be a positive integer
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/4c1cd2517c4dc4da.
Report an issue: GitHub.