langfuse/langfuse · error · Error

--org-id and --org-id-csv are mutually exclusive

Error message

--org-id and --org-id-csv are mutually exclusive

What it means

parseCli rejects running the backfill with both --org-id (single org) and --org-id-csv (bulk list) because they define conflicting iteration modes. The script iterates either one org or a CSV of orgs, never both.

Source

Thrown at web/src/ee/features/sfdc-sync/scripts/backfillSfdcLeads.ts:186

      "batch-size": { type: "string", default: "500" },
      limit: { type: "string" },
      "exclude-org": { type: "string", multiple: true, default: [] },
      "exclude-org-csv": { type: "string" },
      "skip-recent-minutes": { type: "string", default: "0" },
    },
    allowPositionals: false,
  });

  const toInt = (v: string | undefined, fallback: number) => {
    if (v === undefined) return fallback;
    const n = Number.parseInt(v, 10);
    if (!Number.isFinite(n) || n < 0)
      throw new Error(`Invalid numeric flag value: ${v}`);
    return n;
  };

  if (values["org-id"] && values["org-id-csv"])
    throw new Error("--org-id and --org-id-csv are mutually exclusive");
  if (values["org-id"] && values["start-after"])
    throw new Error("--start-after makes no sense with a single --org-id");

  // Refuse to run without the demo-org exclusion: on Cloud every user holds
  // a VIEWER membership in the demo org (created at signup, never synced by
  // the live sync), so an unexcluded demo org would bridge every user to one
  // Account and flip every organic signup's lead source to "Invite".
  if (!env.NEXT_PUBLIC_DEMO_ORG_ID)
    throw new Error(
      "NEXT_PUBLIC_DEMO_ORG_ID is not set — refusing to run. Set it to the " +
        "region's demo org id (same value as the region's web deployment) so " +
        "the demo org is excluded from sync, lead sources, and the orphan sweep.",
    );
  const excludeOrgIds = new Set<string>(values["exclude-org"] as string[]);
  excludeOrgIds.add(env.NEXT_PUBLIC_DEMO_ORG_ID);

  const alreadyDoneOrgIds = new Set<string>(
    values["exclude-org-csv"]

View on GitHub (pinned to 59d92c7cf3)

Solutions

  1. Keep only one mode: drop --org-id for a bulk run or drop --org-id-csv for a single-org run

Example fix

// before
--org-id clx123 --org-id-csv orgs.csv
// after
--org-id-csv orgs.csv
Defensive patterns

Strategy: validation

Validate before calling

const hasOrgId = argv.includes('--org-id');
const hasCsv = argv.includes('--org-id-csv');
if (hasOrgId && hasCsv) {
  console.error('Choose exactly one of --org-id or --org-id-csv');
process.exit(2);
}

Prevention

When it happens

Trigger: Invoking backfillSfdcLeads.ts with both --org-id=<id> and --org-id-csv=<path> on the same command line.

Common situations: Copy-pasting a bulk command and adding --org-id for a quick test, or iterating on flags and forgetting to remove one of the two.

Related errors


AI-assisted analysis of langfuse/langfuse@59d92c7cf3 (2026-08-27). Data as JSON: /api/errors/380edaa1256f18bb. Report an issue: GitHub.