{"record":{"id":"8c87954433adf725","repo":"deepseek-ai/deepseek-harness","slug":"approval-policy-must-be-one-of-ask-or-never","errorCode":null,"errorMessage":"approval policy must be one of \"ask\" or \"never\"","messagePattern":"approval policy must be one of \"ask\" or \"never\"","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/interaction/user-approval/src/index.ts","lineNumber":144,"sourceCode":" */\nfunction hasOpenTurn(events: readonly SessionEvent[]): boolean {\n  for (let index = events.length - 1; index >= 0; index -= 1) {\n    const type = (events[index] as SessionEvent).type\n    if (type === 'turn/start') return true\n    if (type === 'turn/end') return false\n  }\n  return false\n}\n\n/**\n * Append the sole durable representation of a session policy override. Invalid\n * values throw before the log changes; consumers fold the new value on each read.\n * @param session - the session the override belongs to.\n * @param policy - the policy in effect until the next switch.\n */\nexport function setApprovalPolicy(session: Session, policy: ApprovalPolicy): void {\n  if (!APPROVAL_POLICIES.includes(policy)) {\n    throw new TypeError('approval policy must be one of \"ask\" or \"never\"')\n  }\n  session.append('approval/policy', { policy })\n}\n\n/**\n * Readonly same-process permission question. `callId` links to an already\n * presented tool call, so arguments are not duplicated here.\n */\nexport interface ApprovalRequest {\n  /**\n   * The agent on whose behalf the question is asked. Routes the question (a\n   * UI answerer only answers for agents it owns) and receives the audit\n   * events on its session log.\n   */\n  readonly agent: Agent\n  /** The tool the question is about (presentation and audit). */\n  readonly toolName: string\n  /**","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/interaction/user-approval/src/index.ts#L126-L162","documentation":"Error \"approval policy must be one of \"ask\" or \"never\"\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/interaction/user-approval/src/index.ts:144 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the approval policy to \"ask\" or \"never\"."],"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"}