{"record":{"id":"035fafc9bfa145dd","repo":"paperclipai/paperclip","slug":"company-id-is-required-pass-company-id-or-set-p","errorCode":null,"errorMessage":"Company ID is required. Pass --company-id or set PAPERCLIP_COMPANY_ID.","messagePattern":"Company ID is required\\. Pass --company-id or set PAPERCLIP_COMPANY_ID\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/routines.ts","lineNumber":245,"sourceCode":"  } catch (error) {\n    if (embeddedHandle?.startedByThisProcess) {\n      await embeddedHandle.stop().catch(() => undefined);\n    }\n    throw error;\n  }\n}\n\nexport async function disableAllRoutinesInConfig(\n  options: Pick<RoutinesDisableAllOptions, \"config\" | \"companyId\">,\n): Promise<DisableAllRoutinesResult> {\n  const configPath = resolveConfigPath(options.config);\n  loadPaperclipEnvFile(configPath);\n  const companyId =\n    nonEmpty(options.companyId)\n    ?? nonEmpty(process.env.PAPERCLIP_COMPANY_ID)\n    ?? null;\n  if (!companyId) {\n    throw new Error(\"Company ID is required. Pass --company-id or set PAPERCLIP_COMPANY_ID.\");\n  }\n\n  const config = readConfig(configPath);\n  if (!config) {\n    throw new Error(`Config not found at ${configPath}.`);\n  }\n\n  let embeddedHandle: EmbeddedPostgresHandle | null = null;\n  let db: ClosableDb | null = null;\n  try {\n    if (config.database.mode === \"embedded-postgres\") {\n      embeddedHandle = await ensureEmbeddedPostgres(\n        config.database.embeddedPostgresDataDir,\n        config.database.embeddedPostgresPort,\n      );\n      const adminConnectionString = `postgres://paperclip:paperclip@127.0.0.1:${embeddedHandle.port}/postgres`;\n      await ensurePostgresDatabase(adminConnectionString, \"paperclip\");\n      const connectionString = `postgres://paperclip:paperclip@127.0.0.1:${embeddedHandle.port}/paperclip`;","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/routines.ts#L227-L263","documentation":"Thrown by disableAllRoutinesInConfig() when neither the `--company-id` option nor the `PAPERCLIP_COMPANY_ID` environment variable resolves to a non-empty value. Routines are company-scoped, so the operation cannot proceed without a target company.","triggerScenarios":"Running `paperclipai routines disable-all` (or equivalent) without `--company-id` and without `PAPERCLIP_COMPANY_ID` exported in the environment. The check is `nonEmpty(options.companyId) ?? nonEmpty(process.env.PAPERCLIP_COMPANY_ID) ?? null`.","commonSituations":"Operators who normally rely on an env var set in their shell profile, running in a fresh shell or CI where it is not exported; automation that forgot to pass --company-id.","solutions":["Pass the flag explicitly: `paperclipai routines disable-all --company-id <id>`.","Or export the env var once: `export PAPERCLIP_COMPANY_ID=<id>` (add to shell profile or CI secrets).","Confirm the company ID is a valid UUID/identifier accepted by the API."],"exampleFix":"# before\npaperclipai routines disable-all\n# after\nPAPERCLIP_COMPANY_ID=<id> paperclipai routines disable-all","handlingStrategy":"validation","validationCode":"function resolveCompanyId(opt?: string): string {\n  const id = opt?.trim() || process.env.PAPERCLIP_COMPANY_ID?.trim();\n  if (!id) throw new Error('Pass --company-id or set PAPERCLIP_COMPANY_ID.');\n  return id;\n}","typeGuard":"function isCompanyIdSet(opt?: string): opt is string {\n  return Boolean(opt?.trim() || process.env.PAPERCLIP_COMPANY_ID?.trim());\n}","tryCatchPattern":null,"preventionTips":["Set PAPERCLIP_COMPANY_ID in your shell profile or CI environment for the operator.","In scripts, fail fast with a clear message if neither source resolves."],"tags":["cli","config","company-id","env","routines"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}