{"record":{"id":"4c1cd2517c4dc4da","repo":"can1357/oh-my-pi","slug":"invalid-alias-omp-refusing-to-shadow-the-base-o","errorCode":null,"errorMessage":"Invalid alias \"omp\". Refusing to shadow the base omp command.","messagePattern":"Invalid alias \"omp\"\\. Refusing to shadow the base omp command\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/profile-alias.ts","lineNumber":158,"sourceCode":"\tswitch (shell) {\n\t\tcase \"bash\":\n\t\tcase \"zsh\":\n\t\t\treturn POSIX_RESERVED_ALIAS_NAMES;\n\t\tcase \"fish\":\n\t\t\treturn FISH_RESERVED_ALIAS_NAMES;\n\t\tcase \"powershell\":\n\t\tcase \"pwsh\":\n\t\t\treturn POWERSHELL_RESERVED_ALIAS_NAMES;\n\t}\n}\n\nfunction validateAliasName(aliasName: string, shell: ProfileAliasShell): string {\n\tconst normalized = aliasName.trim();\n\tif (!ALIAS_NAME_RE.test(normalized)) {\n\t\tthrow new Error(`Invalid alias \"${aliasName}\". Alias names must match ${ALIAS_NAME_RE.source}.`);\n\t}\n\tif (normalized.toLowerCase() === \"omp\") {\n\t\tthrow new Error('Invalid alias \"omp\". Refusing to shadow the base omp command.');\n\t}\n\tif (getReservedAliasNames(shell).has(normalized.toLowerCase())) {\n\t\tthrow new Error(`Invalid alias \"${aliasName}\". Refusing to create a ${shell} reserved word.`);\n\t}\n\treturn normalized;\n}\n\n// On Windows the launching shell is rarely exported through $SHELL, so when it\n// is missing we infer the PowerShell edition from the inherited environment.\n// PowerShell 7 (pwsh) always seeds PSModulePath with separator-delimited\n// \".../PowerShell/...\" module directories (plus the Windows PowerShell ones for\n// back-compat), whereas Windows PowerShell 5.1 only ever lists\n// \".../WindowsPowerShell/...\". The separator anchors keep \"WindowsPowerShell\"\n// from matching. POWERSHELL_DISTRIBUTION_CHANNEL is set only by some pwsh\n// distributions, so it stays a secondary hint rather than the primary signal.\nfunction detectWindowsPowerShell(env: NodeJS.ProcessEnv): ProfileAliasShell {\n\tconst modulePath = env.PSModulePath ?? env.PSMODULEPATH ?? env.psmodulepath ?? \"\";\n\tif (/[\\\\/]PowerShell[\\\\/]/i.test(modulePath)) return \"pwsh\";","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/profile-alias.ts#L140-L176","documentation":"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.","triggerScenarios":"Running `omp --profile <name> --alias omp` (or `--alias=OMP` / any casing) to install a profile alias whose name is exactly \"omp\".","commonSituations":"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.","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"],"exampleFix":"// before\nomp --profile work --alias omp\n// after\nomp --profile work --alias omp-work","handlingStrategy":"validation","validationCode":"const name = aliasName.trim();\nif (name.toLowerCase() === \"omp\") throw new Error(`Alias \"${aliasName}\" would shadow the base omp command; pick another name`);","typeGuard":"function isSafeAliasName(name: string): boolean {\n  return name.trim().toLowerCase() !== \"omp\";\n}","tryCatchPattern":"try {\n  await installProfileAlias({ profile, aliasName });\n} catch (err) {\n  if (err instanceof Error && err.message.includes('Refusing to shadow the base omp command')) {\n    console.error(`Alias \"${aliasName}\" is reserved; choose a different name.`);\n    process.exitCode = 2;\n    return;\n  }\n  throw err;\n}","preventionTips":["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"],"tags":["cli","validation","alias","naming-conflict"],"backgroundTag":"reserved-name-conflict","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}