deepseek-ai/deepseek-harness · error · Error

goal change goal.blockedReason must have exactly code and…

Error message

goal change goal.blockedReason must have exactly code and message fields

What it means

Canonical-form guard in decodeBlockReason: the logged blockedReason object does not have exactly the keys code and message. Extra or missing keys mean the goal change was not written by the canonical encoder, so replay refuses it.

Solutions

  1. Fix the writer to emit blockedReason with exactly code and message
  2. Report as a serialization bug if produced by the harness itself
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

function positiveInteger(value: unknown, field: string): number {
  if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 1) {
    throw new Error(`goal change ${field} must be a positive safe integer`)
  }
  return value
}

/** Require one non-negative safe integer. */
function nonNegativeInteger(value: unknown, field: string): number {
  if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0) {
    throw new Error(`goal change ${field} must be a non-negative safe integer`)
  }
  return value
}

/** Decode one canonical blocker explanation. */
function decodeBlockReason(value: unknown): GoalBlockReason {
  if (!isRecord(value) || Object.keys(value).sort().join(',') !== 'code,message') {
    throw new Error('goal change goal.blockedReason must have exactly code and message fields')
  }
  if (typeof value['code'] !== 'string' || !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(value['code'])) {
    throw new Error('goal change goal.blockedReason.code must be lower-kebab-case')
  }
  if (typeof value['message'] !== 'string' || value['message'].trim().length === 0
    || value['message'] !== value['message'].trim()) {
    throw new Error('goal change goal.blockedReason.message must be non-empty and normalized')
  }
  return { code: value['code'], message: value['message'] }
}

/** Decode and validate one snapshot. */
function decodeSnapshot(value: unknown): GoalSnapshot {
  if (!isRecord(value)) throw new Error('goal change goal must be a record')
  if (typeof value['id'] !== 'string' || value['id'].length === 0) {
    throw new Error('goal change goal.id must be a non-empty string')
  }
  if (typeof value['objective'] !== 'string' || value['objective'].trim().length === 0

View on GitHub (pinned to b150a551b8)