{"record":{"id":"d4d161f16ad61768","repo":"paperclipai/paperclip","slug":"invalid-by-mode-opts-by-expected-one-of-a","errorCode":null,"errorMessage":"Invalid --by mode '${opts.by}'. Expected one of: auto, id, prefix.","messagePattern":"Invalid --by mode '(.+?)'\\. Expected one of: auto, id, prefix\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/company.ts","lineNumber":1933,"sourceCode":"    company\n      .command(\"delete\")\n      .description(\"Delete a company by ID or shortname/prefix (destructive)\")\n      .argument(\"<selector>\", \"Company ID or issue prefix (for example PAP)\")\n      .option(\n        \"--by <mode>\",\n        \"Selector mode: auto | id | prefix\",\n        \"auto\",\n      )\n      .option(\"--yes\", \"Required safety flag to confirm destructive action\", false)\n      .option(\n        \"--confirm <value>\",\n        \"Required safety value: target company ID or shortname/prefix\",\n      )\n      .action(async (selector: string, opts: CompanyDeleteOptions) => {\n        try {\n          const by = (opts.by ?? \"auto\").trim().toLowerCase() as CompanyDeleteSelectorMode;\n          if (![\"auto\", \"id\", \"prefix\"].includes(by)) {\n            throw new Error(`Invalid --by mode '${opts.by}'. Expected one of: auto, id, prefix.`);\n          }\n\n          const ctx = resolveCommandContext(opts);\n          const normalizedSelector = normalizeSelector(selector);\n          assertDeleteFlags(opts);\n\n          let target: Company | null = null;\n          const shouldTryIdLookup = by === \"id\" || (by === \"auto\" && isUuidLike(normalizedSelector));\n          if (shouldTryIdLookup) {\n            const byId = await ctx.api.get<Company>(apiPath`/api/companies/${normalizedSelector}`, { ignoreNotFound: true });\n            if (byId) {\n              target = byId;\n            } else if (by === \"id\") {\n              throw new Error(`No company found by ID '${normalizedSelector}'.`);\n            }\n          }\n\n          if (!target && ctx.companyId) {","sourceCodeStart":1915,"sourceCodeEnd":1951,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/client/company.ts#L1915-L1951","documentation":"The company delete --by option, lowercased and trimmed, is not one of auto/id/prefix, so the selector resolution mode is unknown.","triggerScenarios":"Thrown at cli/src/commands/client/company.ts:1933 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass --by with one of: auto, id, prefix."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}