koala73/worldmonitor · error · ConvexError

ACCOUNT_NOT_FOUND

ACCOUNT_NOT_FOUND

Error message

ACCOUNT_NOT_FOUND

What it means

Lookup failure in the markAccountDeleted internal mutation: no companyMonitoringAccounts row matched the supplied ownerAccountId via the by_logicalAccountId index. The account being deleted by logical id does not exist — already purged, never existed, or the logical id is wrong.

Solutions

  1. Verify the logicalAccountId being passed; re-resolve it from the owner's current account row
  2. If the account was already terminalized or purged, treat deletion as already complete
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at convex/companyMonitoring/accounts.ts:427 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of koala73/worldmonitor@eeab0a219f (2026-08-21). Data as JSON: /api/errors/ddacbb96353521a0. Report an issue: GitHub.

Appendix: source

Thrown at convex/companyMonitoring/accounts.ts:427

  });
  await scheduleScopedKeyCacheInvalidation(ctx, ownerUserId);
  await scheduleAccountPurge(ctx, ownerFenceHash, purgeGeneration);
  return ctx.db.get(account._id);
}

export const markOwnerDeleted = internalMutation({
  args: { ownerUserId: v.string() },
  handler: async (ctx, args) => terminalize(ctx, args.ownerUserId, "owner_deleted"),
});

export const markAccountDeleted = internalMutation({
  args: { ownerAccountId: v.string() },
  handler: async (ctx, args) => {
    const account = await ctx.db
      .query("companyMonitoringAccounts")
      .withIndex("by_logicalAccountId", (q) => q.eq("logicalAccountId", args.ownerAccountId))
      .unique();
    if (!account || !account.ownerUserId) throw new ConvexError("ACCOUNT_NOT_FOUND");
    return terminalize(ctx, account.ownerUserId, "account_deleted", account);
  },
});

export const advanceAccountPurge = internalMutation({
  args: { ownerFenceHash: v.string(), purgeGeneration: v.number() },
  handler: async (ctx, args) => {
    const account = await ctx.db
      .query("companyMonitoringAccounts")
      .withIndex("by_ownerFenceHash", (q) => q.eq("ownerFenceHash", args.ownerFenceHash))
      .unique();
    if (!account || account.purgeGeneration !== args.purgeGeneration) return { status: "stale" };
    if (account.purgePhase === "none" || account.purgePhase === "complete") {
      return { status: "complete" };
    }

    const now = Date.now();
    if (account.purgePhase === "pending") {

View on GitHub (pinned to eeab0a219f)