langfuse/langfuse · error · Error

--start-after makes no sense with a single --org-id

Error message

--start-after makes no sense with a single --org-id

What it means

parseCli rejects combining --org-id with --start-after. --start-after is a cursor for resuming a bulk iteration over the org table, which is meaningless when the run targets exactly one org.

Source

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

      "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"]
      ? readOrgIdCsv("--exclude-org-csv", values["exclude-org-csv"] as string)
      : [],

View on GitHub (pinned to 59d92c7cf3)

Solutions

  1. Remove --start-after when targeting a single --org-id

Example fix

// before
--org-id clx123 --start-after clx999
// after
--org-id clx123
Defensive patterns

Strategy: validation

Validate before calling

if (argv.includes('--org-id') && argv.includes('--start-after')) {
  console.error('--start-after is only valid for bulk (CSV/table) runs');
  process.exit(2);
}

Prevention

When it happens

Trigger: Invoking backfillSfdcLeads.ts with both --org-id=<id> and --start-after=<orgId>.

Common situations: Resuming an interrupted bulk run but switching to single-org mode, or leaving a resume cursor flag in the command while debugging one org.

Related errors


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