{"record":{"id":"6c05b10053094004","repo":"can1357/oh-my-pi","slug":"alias-requires-a-named-profile-value","errorCode":null,"errorMessage":"--alias requires a named --profile value.","messagePattern":"--alias requires a named --profile value\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/profile-alias.ts","lineNumber":348,"sourceCode":"\treturn Bun.file(filePath).text();\n}\n\nexport async function readProfileAliasConfigFile(\n\tfilePath: string,\n\treadText: (filePath: string) => Promise<string> = readAliasConfigText,\n): Promise<string> {\n\ttry {\n\t\treturn await readText(filePath);\n\t} catch (error) {\n\t\tif (isEnoentError(error)) return \"\";\n\t\tthrow error;\n\t}\n}\n\nexport async function installProfileAlias(options: ProfileAliasInstallOptions): Promise<ProfileAliasInstallResult> {\n\tconst profile = normalizeProfileName(options.profile);\n\tif (!profile) {\n\t\tthrow new Error(\"--alias requires a named --profile value.\");\n\t}\n\tconst platform = options.platform ?? process.platform;\n\tconst homeDir = options.homeDir ?? os.homedir();\n\tconst env = options.env ?? process.env;\n\tconst shell = normalizeShellName(options.shellPath ?? env.SHELL, platform, env);\n\tconst aliasName = validateAliasName(options.aliasName, shell);\n\tconst configPath = resolveShellConfigPath(shell, homeDir, platform, env);\n\tconst { block, command } = renderAliasBlock(shell, aliasName, profile, options.command ?? DEFAULT_ALIAS_COMMAND);\n\tconst readFile = options.readFile ?? readProfileAliasConfigFile;\n\tconst writeFile =\n\t\toptions.writeFile ??\n\t\t(async (filePath, content) => {\n\t\t\tawait Bun.write(filePath, content);\n\t\t});\n\n\tconst current = await readFile(configPath);\n\tawait writeFile(configPath, upsertBlock(current, aliasName, block));\n","sourceCodeStart":330,"sourceCodeEnd":366,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/profile-alias.ts#L330-L366","documentation":"installProfileAlias requires a named profile; normalizeProfileName returned empty (meaning the profile was the unnamed/default one or absent), so there is nothing to encode into the alias command. The alias must point at a concrete named profile.","triggerScenarios":"Running `omp --alias myname` without a `--profile <name>` (or with `--profile` resolving to the empty/default profile name), so installProfileAlias receives options.profile that normalizes to \"\".","commonSituations":"Users running `--alias` alone thinking it installs a generic alias; using `--profile` pointing at a default/unnamed profile defined in config without a name.","solutions":["Provide a named profile: `omp --profile <name> --alias <aliasName>`","Define the profile with a name in your omp config if it currently has none","Drop --alias if you did not intend to install a shell alias"],"exampleFix":"// before\nomp --alias work\n// after\nomp --profile work --alias work","handlingStrategy":"validation","validationCode":"if (!profile || profile === \"default\") {\n  throw new Error(\"--alias requires a named --profile value; pass e.g. --profile work\");\n}","typeGuard":"function hasNamedProfile(args: string[]): boolean {\n  const i = args.indexOf(\"--profile\");\n  return i !== -1 && !!args[i + 1] && !args[i + 1].startsWith(\"-\");\n}","tryCatchPattern":"try {\n  await installProfileAlias({ profile, aliasName });\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"--alias requires a named --profile\")) {\n    console.error(\"Usage: omp --profile <name> --alias <aliasName>\");\n    process.exitCode = 2;\n    return;\n  }\n  throw err;\n}","preventionTips":["Always pair --alias with an explicit named --profile in the same command","Do not rely on a default/unnamed profile when installing aliases","Document the required flag pair in wrapper scripts that invoke omp --alias"],"tags":["cli","argument-validation","profile","alias"],"backgroundTag":"missing-required-argument","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}