{"record":{"id":"fb77308e6c2942fd","repo":"koala73/worldmonitor","slug":"replay-conflict","errorCode":null,"errorMessage":"REPLAY_CONFLICT","messagePattern":"REPLAY_CONFLICT","errorType":"exception","errorClass":"ConvexError","httpStatus":null,"severity":"error","filePath":"convex/companyMonitoring/companies.ts","lineNumber":123,"sourceCode":"    ownerUserId: v.string(),\n    clientRequestId: v.string(),\n    company: monitoredCompanyInputValidator,\n  },\n  handler: async (ctx, args) => {\n    const account = await requireProvisionedAccount(ctx, args.ownerUserId);\n    const clientRequestId = normalizeRequestId(args.clientRequestId);\n    const company = normalizeMonitoredCompanyInput(args.company as MonitoredCompanyInput);\n    const directFingerprint = await fingerprint({ version: \"cm-direct-v1\", company });\n\n    const replay = await ctx.db\n      .query(\"companyMonitoringCompanies\")\n      .withIndex(\"by_account_directRequestId\", (q) =>\n        q.eq(\"ownerAccountId\", account.logicalAccountId).eq(\"directRequestId\", clientRequestId),\n      )\n      .unique();\n    if (replay) {\n      if (replay.directFingerprint !== directFingerprint) {\n        throw new ConvexError(\"REPLAY_CONFLICT\");\n      }\n      return { status: \"replayed\", companyId: replay.companyId };\n    }\n\n    const noop = await findNoopByCustomerReference(\n      ctx,\n      account.logicalAccountId,\n      company.customerReference,\n    );\n    if (noop) return { status: \"noop\", companyId: noop.companyId };\n\n    const companyCount = account.companyCount ?? 0;\n    if (companyCount >= (account.companyLimit ?? COMPANY_LIMIT)) {\n      throw new ConvexError(\"COMPANY_LIMIT_REACHED\");\n    }\n\n    const companyId = await insertNormalizedCompany(ctx, account, company, {\n      directRequestId: clientRequestId,","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/koala73/worldmonitor/blob/ffec79ac339946fd2d24e85845da5755dcaa534b/convex/companyMonitoring/companies.ts#L105-L141","documentation":"Error \"REPLAY_CONFLICT\" thrown in koala73/worldmonitor.","triggerScenarios":"Thrown at convex/companyMonitoring/companies.ts:123 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ffec79ac339946fd2d24e85845da5755dcaa534b","analyzedAt":"2026-08-12T11:24:56.012Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}