{"record":{"id":"202da6eeaf88c0a7","repo":"deepseek-ai/deepseek-harness","slug":"goal-clear-change-must-have-exactly-allowed-sort","errorCode":null,"errorMessage":"goal clear change must have exactly ${allowed.sort().join(',')} fields","messagePattern":"goal clear change must have exactly (.+?) fields","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/goal/goal/src/fold.ts","lineNumber":142,"sourceCode":"  }\n  return { id: GoalId(value['id']), revision: positiveInteger(value['revision'], 'cleared.revision') }\n}\n\n/**\n * Decode a value that declares itself as a goal change. Unrelated values\n * return `undefined`; malformed goal changes fail replay loudly.\n * @param value - candidate source change.\n * @returns validated goal change or `undefined` for another value kind.\n */\nexport function decodeGoalChange(value: unknown): GoalChangeMeta | undefined {\n  if (!isRecord(value) || value['kind'] !== 'goal/change') return undefined\n  if (value['version'] !== GOAL_CHANGE_VERSION) {\n    throw new Error(`unsupported goal change version ${String(value['version'])}`)\n  }\n  if (value['operation'] === 'clear') {\n    const allowed = ['cleared', 'clearedAt', 'kind', 'operation', 'version']\n    if (Object.keys(value).sort().join(',') !== allowed.sort().join(',')) {\n      throw new Error(`goal clear change must have exactly ${allowed.sort().join(',')} fields`)\n    }\n    return {\n      kind: 'goal/change',\n      version: GOAL_CHANGE_VERSION,\n      operation: 'clear',\n      cleared: decodeRef(value['cleared']),\n      clearedAt: nonNegativeInteger(value['clearedAt'], 'clearedAt'),\n    } satisfies GoalClearChangeMeta\n  }\n  if (typeof value['operation'] !== 'string'\n    || !SNAPSHOT_OPERATIONS.has(value['operation'] as Exclude<GoalOperation, 'clear'>)) {\n    throw new Error('goal change operation is invalid')\n  }\n  const allowed = ['createdAt', 'goal', 'kind', 'operation', 'roundsStarted', 'updatedAt', 'version']\n  if (Object.keys(value).sort().join(',') !== allowed.sort().join(',')) {\n    throw new Error(`goal snapshot change must have exactly ${allowed.sort().join(',')} fields`)\n  }\n  const createdAt = nonNegativeInteger(value['createdAt'], 'createdAt')","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/goal/goal/src/fold.ts#L124-L160","documentation":"Error \"goal clear change must have exactly ${allowed.sort().join(',')} fields\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/goal/goal/src/fold.ts:142 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}