{"record":{"id":"113bb64e07a75c1a","repo":"stablyai/orca","slug":"invalid-argument-113bb6","errorCode":"invalid_argument","errorMessage":"Missing required ${name}.","messagePattern":"Missing required (.+?)\\.","errorType":"exception","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/cli/handlers/artifacts.ts","lineNumber":33,"sourceCode":"import {\n  ARTIFACT_SHARING_DISABLED_CODE,\n  ARTIFACT_SHARING_DISABLED_MESSAGE,\n  ARTIFACT_SHARING_DISABLED_NEXT_STEPS\n} from '../../shared/artifact-sharing-gate'\nimport type { CommandHandler, HandlerContext } from '../dispatch'\nimport { RuntimeClientError } from '../runtime-client'\nimport { formatArtifactListPage, formatArtifactShared } from '../artifact-format'\nimport { printResult } from '../format'\n\nfunction stringFlag(ctx: HandlerContext, name: string): string | undefined {\n  const value = ctx.flags.get(name)\n  return typeof value === 'string' && value.trim() ? value.trim() : undefined\n}\n\nfunction requireStringFlag(ctx: HandlerContext, name: string): string {\n  const value = stringFlag(ctx, name)\n  if (!value) {\n    throw new RuntimeClientError('invalid_argument', `Missing required ${name}.`)\n  }\n  return value\n}\n\nfunction cloudOptions(ctx: HandlerContext): ArtifactCloudOptions {\n  const apiUrl = stringFlag(ctx, 'api-url') ?? process.env.ORCA_ARTIFACTS_API_URL?.trim()\n  const authToken = process.env.ORCA_CLOUD_AUTH_TOKEN?.trim()\n  return {\n    ...(apiUrl ? { apiUrl } : {}),\n    ...(authToken ? { authToken } : {})\n  }\n}\n\nfunction rejectRemoteSelectionFlags(ctx: HandlerContext): void {\n  for (const flag of ['environment', 'pairing-code']) {\n    if (ctx.flags.has(flag)) {\n      throw new RuntimeClientError(\n        'invalid_argument',","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/cli/handlers/artifacts.ts#L15-L51","documentation":"Thrown by requireStringFlag() in the artifacts CLI handler when a required string flag is absent, empty, or whitespace-only. stringFlag() returns undefined unless ctx.flags.get(name) is a non-empty trimmed string, so any falsy/blank value trips the guard. The message interpolates the offending flag name (e.g. 'file' or 'id'). It is a client-side invalid_argument error raised before any RPC is attempted.","triggerScenarios":"Invoking `orca artifacts share` or `orca artifacts update` without `--file`; `orca artifacts delete` without `--id`; `orca artifacts unshare` without `--file` and without a REMOTE_ARTIFACT_INPUT_ENV override. Also fires when the flag is present but blank (e.g. `--file ''`) or set to a boolean true with no value.","commonSituations":"Forgetting the positional/flag argument after copy-pasting a command from docs that used a placeholder; shell quoting that swallows the value (`--file=$EMPTY`); scripts that conditionally omit the flag; piping assumptions where the user expects stdin to substitute for --file (it does not for the local path branch).","solutions":["Re-run the command with the missing flag, e.g. `orca artifacts share --file ./report.html` or `orca artifacts delete --id <artifact-id>`.","If scripting, check the flag is a non-empty string before invoking: guard `if [ -n \"$FILE\" ]` in shell, or validate the value in TS before building the HandlerContext.","Confirm you are not passing `--file` with an empty quoted value; remove the flag entirely rather than blanking it.","For remote/bridged runs, set the REMOTE_ARTIFACT_INPUT_ENV env var so sourceKey is taken from there instead of --file (unshare path)."],"exampleFix":"// before\norca artifacts share   // ERROR: Missing required file.\n\n// after\norca artifacts share --file ./out/report.html","handlingStrategy":"validation","validationCode":"function buildArtifactsArgs(flags: Record<string, string|boolean>, require: ('file'|'id')[]) {\n  for (const name of require) {\n    const v = flags[name]\n    if (typeof v !== 'string' || v.trim().length === 0) {\n      throw new Error(`Missing required --${name}`)\n    }\n  }\n}\n// call before dispatching 'artifacts share/update/unshare' (need --file) or 'artifacts delete' (need --id)","typeGuard":"const isNonEmptyString = (v: unknown): v is string =>\n  typeof v === 'string' && v.trim().length > 0","tryCatchPattern":"try {\n  await dispatch('artifacts share', ctx)\n} catch (e) {\n  if (e instanceof RuntimeClientError && e.code === 'invalid_argument' && /Missing required/.test(e.message)) {\n    // surface to the user which flag is missing (name is in the message)\n  }\n  throw e\n}","preventionTips":["Validate required flags in your CLI wrapper before invoking the orca handler.","Treat empty/whitespace values the same as missing — requireStringFlag does.","For scripts, fail fast with a clear usage message instead of letting the handler reject."],"tags":["cli","argument-validation","artifacts","invalid-argument"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}