can1357/oh-my-pi · error · Error

--alias requires a named --profile value.

Error message

--alias requires a named --profile value.

What it means

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.

Source

Thrown at packages/coding-agent/src/cli/profile-alias.ts:348

	return Bun.file(filePath).text();
}

export async function readProfileAliasConfigFile(
	filePath: string,
	readText: (filePath: string) => Promise<string> = readAliasConfigText,
): Promise<string> {
	try {
		return await readText(filePath);
	} catch (error) {
		if (isEnoentError(error)) return "";
		throw error;
	}
}

export async function installProfileAlias(options: ProfileAliasInstallOptions): Promise<ProfileAliasInstallResult> {
	const profile = normalizeProfileName(options.profile);
	if (!profile) {
		throw new Error("--alias requires a named --profile value.");
	}
	const platform = options.platform ?? process.platform;
	const homeDir = options.homeDir ?? os.homedir();
	const env = options.env ?? process.env;
	const shell = normalizeShellName(options.shellPath ?? env.SHELL, platform, env);
	const aliasName = validateAliasName(options.aliasName, shell);
	const configPath = resolveShellConfigPath(shell, homeDir, platform, env);
	const { block, command } = renderAliasBlock(shell, aliasName, profile, options.command ?? DEFAULT_ALIAS_COMMAND);
	const readFile = options.readFile ?? readProfileAliasConfigFile;
	const writeFile =
		options.writeFile ??
		(async (filePath, content) => {
			await Bun.write(filePath, content);
		});

	const current = await readFile(configPath);
	await writeFile(configPath, upsertBlock(current, aliasName, block));

View on GitHub (pinned to 9690622007)

Solutions

  1. Provide a named profile: `omp --profile <name> --alias <aliasName>`
  2. Define the profile with a name in your omp config if it currently has none
  3. Drop --alias if you did not intend to install a shell alias

Example fix

// before
omp --alias work
// after
omp --profile work --alias work
Defensive patterns

Strategy: validation

Validate before calling

if (!profile || profile === "default") {
  throw new Error("--alias requires a named --profile value; pass e.g. --profile work");
}

Type guard

function hasNamedProfile(args: string[]): boolean {
  const i = args.indexOf("--profile");
  return i !== -1 && !!args[i + 1] && !args[i + 1].startsWith("-");
}

Try / catch

try {
  await installProfileAlias({ profile, aliasName });
} catch (err) {
  if (err instanceof Error && err.message.includes("--alias requires a named --profile")) {
    console.error("Usage: omp --profile <name> --alias <aliasName>");
    process.exitCode = 2;
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: 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 "".

Common situations: Users running `--alias` alone thinking it installs a generic alias; using `--profile` pointing at a default/unnamed profile defined in config without a name.

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


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/6c05b10053094004. Report an issue: GitHub.