paperclipai/paperclip · error
Company ID is required. Pass --company-id or set PAPERCLIP_C
Error message
Company ID is required. Pass --company-id or set PAPERCLIP_COMPANY_ID.
What it means
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.
Source
Thrown at cli/src/commands/routines.ts:245
} catch (error) {
if (embeddedHandle?.startedByThisProcess) {
await embeddedHandle.stop().catch(() => undefined);
}
throw error;
}
}
export async function disableAllRoutinesInConfig(
options: Pick<RoutinesDisableAllOptions, "config" | "companyId">,
): Promise<DisableAllRoutinesResult> {
const configPath = resolveConfigPath(options.config);
loadPaperclipEnvFile(configPath);
const companyId =
nonEmpty(options.companyId)
?? nonEmpty(process.env.PAPERCLIP_COMPANY_ID)
?? null;
if (!companyId) {
throw new Error("Company ID is required. Pass --company-id or set PAPERCLIP_COMPANY_ID.");
}
const config = readConfig(configPath);
if (!config) {
throw new Error(`Config not found at ${configPath}.`);
}
let embeddedHandle: EmbeddedPostgresHandle | null = null;
let db: ClosableDb | null = null;
try {
if (config.database.mode === "embedded-postgres") {
embeddedHandle = await ensureEmbeddedPostgres(
config.database.embeddedPostgresDataDir,
config.database.embeddedPostgresPort,
);
const adminConnectionString = `postgres://paperclip:paperclip@127.0.0.1:${embeddedHandle.port}/postgres`;
await ensurePostgresDatabase(adminConnectionString, "paperclip");
const connectionString = `postgres://paperclip:paperclip@127.0.0.1:${embeddedHandle.port}/paperclip`;View on GitHub (pinned to 67001ec6eb)
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.
Example fix
# before paperclipai routines disable-all # after PAPERCLIP_COMPANY_ID=<id> paperclipai routines disable-all
Defensive patterns
Strategy: validation
Validate before calling
function resolveCompanyId(opt?: string): string {
const id = opt?.trim() || process.env.PAPERCLIP_COMPANY_ID?.trim();
if (!id) throw new Error('Pass --company-id or set PAPERCLIP_COMPANY_ID.');
return id;
} Type guard
function isCompanyIdSet(opt?: string): opt is string {
return Boolean(opt?.trim() || process.env.PAPERCLIP_COMPANY_ID?.trim());
} Prevention
- 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.
When it happens
Trigger: 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`.
Common situations: 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.
Related errors
- Failed to parse JSON at ${filePath}: ${err instanceof Error
- Environment variable ${envName} is empty or not set.
- Company ID is required. Pass --company-id, set PAPERCLIP_COM
- Target existing company requires --company-id (or context de
- Current company is not available. Pass --company-id, set PAP
AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12).
Data as JSON: /api/errors/035fafc9bfa145dd.
Report an issue: GitHub.