{"record":{"id":"a38d2d1b6046119e","repo":"langfuse/langfuse","slug":"start-after-makes-no-sense-with-a-single-org-i","errorCode":null,"errorMessage":"--start-after makes no sense with a single --org-id","messagePattern":"--start-after makes no sense with a single --org-id","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"web/src/ee/features/sfdc-sync/scripts/backfillSfdcLeads.ts","lineNumber":188,"sourceCode":"      \"exclude-org\": { type: \"string\", multiple: true, default: [] },\n      \"exclude-org-csv\": { type: \"string\" },\n      \"skip-recent-minutes\": { type: \"string\", default: \"0\" },\n    },\n    allowPositionals: false,\n  });\n\n  const toInt = (v: string | undefined, fallback: number) => {\n    if (v === undefined) return fallback;\n    const n = Number.parseInt(v, 10);\n    if (!Number.isFinite(n) || n < 0)\n      throw new Error(`Invalid numeric flag value: ${v}`);\n    return n;\n  };\n\n  if (values[\"org-id\"] && values[\"org-id-csv\"])\n    throw new Error(\"--org-id and --org-id-csv are mutually exclusive\");\n  if (values[\"org-id\"] && values[\"start-after\"])\n    throw new Error(\"--start-after makes no sense with a single --org-id\");\n\n  // Refuse to run without the demo-org exclusion: on Cloud every user holds\n  // a VIEWER membership in the demo org (created at signup, never synced by\n  // the live sync), so an unexcluded demo org would bridge every user to one\n  // Account and flip every organic signup's lead source to \"Invite\".\n  if (!env.NEXT_PUBLIC_DEMO_ORG_ID)\n    throw new Error(\n      \"NEXT_PUBLIC_DEMO_ORG_ID is not set — refusing to run. Set it to the \" +\n        \"region's demo org id (same value as the region's web deployment) so \" +\n        \"the demo org is excluded from sync, lead sources, and the orphan sweep.\",\n    );\n  const excludeOrgIds = new Set<string>(values[\"exclude-org\"] as string[]);\n  excludeOrgIds.add(env.NEXT_PUBLIC_DEMO_ORG_ID);\n\n  const alreadyDoneOrgIds = new Set<string>(\n    values[\"exclude-org-csv\"]\n      ? readOrgIdCsv(\"--exclude-org-csv\", values[\"exclude-org-csv\"] as string)\n      : [],","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/langfuse/langfuse/blob/59d92c7cf365150d10b753b5a0d1708902a2ed60/web/src/ee/features/sfdc-sync/scripts/backfillSfdcLeads.ts#L170-L206","documentation":"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.","triggerScenarios":"Invoking backfillSfdcLeads.ts with both --org-id=<id> and --start-after=<orgId>.","commonSituations":"Resuming an interrupted bulk run but switching to single-org mode, or leaving a resume cursor flag in the command while debugging one org.","solutions":["Remove --start-after when targeting a single --org-id"],"exampleFix":"// before\n--org-id clx123 --start-after clx999\n// after\n--org-id clx123","handlingStrategy":"validation","validationCode":"if (argv.includes('--org-id') && argv.includes('--start-after')) {\n  console.error('--start-after is only valid for bulk (CSV/table) runs');\n  process.exit(2);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Document that --start-after pairs only with bulk iteration modes"],"tags":["cli","sfdc-sync","mutually-exclusive-flags"],"backgroundTag":"conflicting-cli-options","analyzedSha":"59d92c7cf365150d10b753b5a0d1708902a2ed60","analyzedAt":"2026-08-27T22:22:00.402Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}