deepseek-ai/deepseek-harness · error · Error

goal cannot change objective or maxGoalRounds

Error message

goal ${operation} cannot change objective or maxGoalRounds

What it means

Transition guard in requireSameDefinition: a non-edit snapshot operation (pause, resume, complete) attempted to change the goal's objective or maxGoalRounds, which only edit may replace. The projected fold state and the incoming change disagree on immutable fields.

Solutions

  1. Use the edit operation to change objective or maxGoalRounds
  2. Keep objective and maxGoalRounds unchanged in pause/resume/complete changes
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/goal/goal/src/fold.ts:188 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/f011fb5e11d9f0f5. Report an issue: GitHub.

Appendix: source

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

    updatedAt,
  } satisfies GoalSnapshotChangeMeta
}

/** Narrow model attribution to a valid goal source. */
function goalSource(source: MessageSource): GoalMessageSource | undefined {
  if (source.kind !== 'goal') return undefined
  if (typeof source.goalId !== 'string' || source.goalId.length === 0
    || !Number.isSafeInteger(source.revision) || source.revision < 1
    || !Number.isSafeInteger(source.round) || source.round < 1) {
    throw new Error('goal message source is invalid')
  }
  return source
}

/** Require two snapshots to retain fields that only `edit` may replace. */
function requireSameDefinition(current: GoalSnapshot, next: GoalSnapshot, operation: GoalOperation): void {
  if (next.objective !== current.objective || next.maxGoalRounds !== current.maxGoalRounds) {
    throw new Error(`goal ${operation} cannot change objective or maxGoalRounds`)
  }
}

/** Require one exact next revision of the current goal. */
function requireNextRevision(current: GoalSnapshot, next: GoalRef, operation: GoalOperation): void {
  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)

View on GitHub (pinned to b150a551b8)