Incredibly cryptic error when running DB transaction

I have this piece of code:
  const [newSolution] = await db.transaction(async (tx) => {
    await tx.update(csTable).set({ state: "archived" }).where(eq(csTable.state, "solved"));
    return await tx.insert(csTable).values([newCollectiveSolution]).returning(collectiveSolutionsPublicCols);
  });

And it keeps causing this cryptic error every time it's run:
⨯ TypeError: value.toISOString is not a function
     at Array.map (<anonymous>)
     at Array.map (<anonymous>)
     at Array.map (<anonymous>)
     at eventLoopTick (ext:core/01_core.js:178:7) {
   digest: "617867408"
 }

The error goes away when I comment out the second line, but I don't understand why. The update call is supposed to just not find any entries matching the query (given the current state of my DB) and simply update nothing, but instead it errors out.
Was this page helpful?