deepseek-ai/deepseek-harness · error · Error

goal does not preserve the current counters and timestamps

Error message

goal ${change.operation} does not preserve the current counters and timestamps

What it means

Continuity guard in validateSnapshotTransition: the change's createdAt differs from the fold's, its updatedAt goes backwards, or roundsStarted disagrees with the projected counter. Snapshot operations must preserve the accumulated counters and timestamps exactly.

Solutions

  1. Echo createdAt, roundsStarted, and an updatedAt at or after the fold's value from the current state
  2. Report as a fold bug if the values were copied faithfully
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/goal/goal/src/fold.ts:212 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/63b28151bd7fc7b4. Report an issue: GitHub.

Appendix: source

Thrown at packages/goal/goal/src/fold.ts:212

  if (next.id !== current.id || next.revision !== current.revision + 1) {
    throw new Error(`goal ${operation} must advance the current goal by one revision`)
  }
}

/** Validate one non-create snapshot operation against the preceding projection. */
function validateSnapshotTransition(
  state: GoalFoldState,
  change: GoalSnapshotChangeMeta,
  current: GoalSnapshot,
): void {
  const next = change.goal
  requireNextRevision(current, next, change.operation)
  /* v8 ignore next -- a current goal established by this fold always has an updatedAt */
  if (state.updatedAt === undefined) throw new Error('current goal fold lacks updatedAt')
  if (change.createdAt !== state.createdAt
    || change.updatedAt < state.updatedAt
    || change.roundsStarted !== state.roundsStarted) {
    throw new Error(`goal ${change.operation} does not preserve the current counters and timestamps`)
  }
  switch (change.operation) {
    case 'edit':
      if (next.phase !== current.phase
        || JSON.stringify(next.blockedReason) !== JSON.stringify(current.blockedReason)) {
        throw new Error('goal edit cannot change phase or blocked reason')
      }
      break
    case 'pause':
      requireSameDefinition(current, next, change.operation)
      if (current.phase !== 'active' || next.phase !== 'paused') throw new Error('goal pause has an invalid phase transition')
      break
    case 'resume': {
      requireSameDefinition(current, next, change.operation)
      const resumable: ReadonlySet<GoalPhase> = new Set([
        'active',
        'paused',
        'blocked',

View on GitHub (pinned to b150a551b8)