deepseek-ai/deepseek-harness · error · Error
goal change goal for phase
Error message
goal change goal for phase ${phase} must have exactly ${expectedKeys} fields What it means
Strict key-set guard in decodeSnapshot: the goal record carries keys beyond the exact canonical set for its phase (blocked goals additionally require blockedReason). Extra or missing keys mean a foreign writer; replay refuses the change rather than silently dropping fields.
Solutions
- Fix the writer to emit exactly the canonical fields listed in the message
- Report as a schema-drift bug if the harness produced the change
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/goal/goal/src/fold.ts:105 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/85d71e53273dbc05.
Report an issue: GitHub.
Appendix: source
Thrown at packages/goal/goal/src/fold.ts:105
/** 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
|| value['objective'] !== value['objective'].trim()) {
throw new Error('goal change goal.objective must be non-empty and normalized')
}
if (typeof value['phase'] !== 'string' || !PHASES.has(value['phase'] as GoalPhase)) {
throw new Error('goal change goal.phase is invalid')
}
const phase = value['phase'] as GoalPhase
const expectedKeys = phase === 'blocked'
? 'blockedReason,id,maxGoalRounds,objective,phase,revision'
: 'id,maxGoalRounds,objective,phase,revision'
if (Object.keys(value).sort().join(',') !== expectedKeys) {
throw new Error(`goal change goal for phase ${phase} must have exactly ${expectedKeys} fields`)
}
return {
id: GoalId(value['id']),
revision: positiveInteger(value['revision'], 'goal.revision'),
objective: value['objective'],
phase,
maxGoalRounds: positiveInteger(value['maxGoalRounds'], 'goal.maxGoalRounds'),
...phase === 'blocked' ? { blockedReason: decodeBlockReason(value['blockedReason']) } : {},
}
}
/** Decode and validate one ref. */
function decodeRef(value: unknown): GoalRef {
if (!isRecord(value) || Object.keys(value).sort().join(',') !== 'id,revision') {
throw new Error('goal clear tombstone must have exactly id and revision fields')
}
if (typeof value['id'] !== 'string' || value['id'].length === 0) {
throw new Error('goal clear tombstone id must be a non-empty string')View on GitHub (pinned to b150a551b8)