{"record":{"id":"75f56fdbc876fed3","repo":"can1357/oh-my-pi","slug":"profile-requires-a-profile-name","errorCode":null,"errorMessage":"--profile requires a profile name","messagePattern":"--profile requires a profile name","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/profile-bootstrap.ts","lineNumber":112,"sourceCode":"\t\t\tif (!arg.startsWith(\"-\")) {\n\t\t\t\tstripped.push(PROFILE_BOOTSTRAP_BOUNDARY_ARG);\n\t\t\t}\n\t\t\tinsertBoundaryBeforeNextValue = false;\n\t\t}\n\n\t\t// `--` ends option processing. Anything that follows is forwarded verbatim\n\t\t// so users can pass arbitrary tokens (including a literal `--profile`) to\n\t\t// downstream tools without the bootstrap stealing them.\n\t\tif (arg === \"--\") {\n\t\t\tpassThrough = true;\n\t\t\tstripped.push(arg);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arg === \"--profile\") {\n\t\t\tconst value = argv[index + 1];\n\t\t\tif (!value || value.startsWith(\"-\")) {\n\t\t\t\tthrow new Error(\"--profile requires a profile name\");\n\t\t\t}\n\t\t\tprofile = value;\n\t\t\tinsertBoundaryBeforeNextValue = needsBoundaryAfterGlobalStrip(stripped);\n\t\t\tindex += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (arg.startsWith(\"--profile=\")) {\n\t\t\tconst value = arg.slice(\"--profile=\".length);\n\t\t\tif (!value) {\n\t\t\t\tthrow new Error(\"--profile requires a profile name\");\n\t\t\t}\n\t\t\tprofile = value;\n\t\t\tinsertBoundaryBeforeNextValue = needsBoundaryAfterGlobalStrip(stripped);\n\t\t\tcontinue;\n\t\t}\n\t\tif (arg === \"--alias\") {\n\t\t\tconst value = argv[index + 1];\n\t\t\tif (!value || value.startsWith(\"-\")) {","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/profile-bootstrap.ts#L94-L130","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Supply the name directly: `omp --profile <name> ...`","Use the `=` form: `omp --profile=<name> ...` so a missing value cannot be mistaken for another flag","Fix the script so the profile-name variable is non-empty before invoking"],"exampleFix":"// before\nomp --profile --alias work\n// after\nomp --profile work --alias work","handlingStrategy":"validation","validationCode":"const i = argv.indexOf(\"--profile\");\nif (i !== -1) {\n  const v = argv[i + 1];\n  if (!v || v.startsWith(\"-\")) throw new Error(\"--profile requires a value: use --profile <name> or --profile=<name>\");\n}","typeGuard":"function profileFlagHasValue(argv: string[]): boolean {\n  const i = argv.indexOf(\"--profile\");\n  return i === -1 || (i + 1 < argv.length && !argv[i + 1].startsWith(\"-\"));\n}","tryCatchPattern":"try {\n  await runCli(argv);\n} catch (err) {\n  if (err instanceof Error && err.message === \"--profile requires a profile name\") {\n    console.error(\"Usage: omp --profile <name> [...]\");\n    process.exitCode = 2;\n    return;\n  }\n  throw err;\n}","preventionTips":["Prefer the --profile=<name> form in scripts so a missing value is caught at token level","Quote and validate profile-name variables: [ -n \"$PROFILE\" ] || exit 1","Never place another flag immediately after a bare --profile"],"tags":["cli","argument-validation","profile","parsing"],"backgroundTag":"missing-required-argument","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}