can1357/oh-my-pi · error · Error

--profile requires a profile name

Error message

--profile requires a profile name

What it means

extractProfileFlags (pre-CLI-bootstrapping argv parsing) saw a bare `--profile` flag whose next argv element is missing or starts with `-`, i.e. no profile name was supplied. Because this runs before full CLI parsing, it throws early with a focused message instead of a generic usage error.

Source

Thrown at packages/coding-agent/src/cli/profile-bootstrap.ts:112

			if (!arg.startsWith("-")) {
				stripped.push(PROFILE_BOOTSTRAP_BOUNDARY_ARG);
			}
			insertBoundaryBeforeNextValue = false;
		}

		// `--` ends option processing. Anything that follows is forwarded verbatim
		// so users can pass arbitrary tokens (including a literal `--profile`) to
		// downstream tools without the bootstrap stealing them.
		if (arg === "--") {
			passThrough = true;
			stripped.push(arg);
			continue;
		}

		if (arg === "--profile") {
			const value = argv[index + 1];
			if (!value || value.startsWith("-")) {
				throw new Error("--profile requires a profile name");
			}
			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("-")) {

View on GitHub (pinned to 9690622007)

Solutions

  1. Supply the name directly: `omp --profile <name> ...`
  2. Use the `=` form: `omp --profile=<name> ...` so a missing value cannot be mistaken for another flag
  3. Fix the script so the profile-name variable is non-empty before invoking

Example fix

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

Strategy: validation

Validate before calling

const i = argv.indexOf("--profile");
if (i !== -1) {
  const v = argv[i + 1];
  if (!v || v.startsWith("-")) throw new Error("--profile requires a value: use --profile <name> or --profile=<name>");
}

Type guard

function profileFlagHasValue(argv: string[]): boolean {
  const i = argv.indexOf("--profile");
  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 === "--profile requires a profile name") {
    console.error("Usage: omp --profile <name> [...]");
    process.exitCode = 2;
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: Invoking `omp --profile` as the last argument, or `omp --profile --alias work` / `omp --profile -y ...` where the next token looks like another flag rather than a value.

Common situations: Truncated commands in shell history re-runs; copy-paste dropping the profile name; scripting where a variable holding the profile name is empty and the following arg is a flag.

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/75f56fdbc876fed3. Report an issue: GitHub.