{"record":{"id":"2b0c4b8308e0f46f","repo":"deepseek-ai/deepseek-harness","slug":"operation-must-be-one-of-lsp-operations-join","errorCode":null,"errorMessage":"operation must be one of ${LSP_OPERATIONS.join(', ')}","messagePattern":"operation must be one of (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/lsp/tool-lsp/src/render.ts","lineNumber":48,"sourceCode":"\n/** The raw, schema-typed argument shape. */\nexport interface LspToolArgs {\n  readonly operation: string\n  readonly file_path: string\n  readonly line: number\n  readonly character: number\n}\n\n/**\n * Validate and convert model arguments: `operation` must be one of the four; `line`/`character` are\n * positive one-based integers converted to the seam's zero-based position.\n * @param args - the schema-validated raw arguments.\n * @returns the validated input with a zero-based position.\n * @throws Error when the operation is unknown or a coordinate is not a positive integer.\n */\nexport function parseLspArgs(args: LspToolArgs): LspToolInput {\n  if (!isOperation(args.operation)) {\n    throw new Error(`operation must be one of ${LSP_OPERATIONS.join(', ')}`)\n  }\n  if (args.file_path.trim().length === 0) throw new Error('file_path must be a non-empty string')\n  const line = oneBased(args.line, 'line')\n  const character = oneBased(args.character, 'character')\n  return {\n    operation: args.operation,\n    filePath: args.file_path,\n    // The model counts from 1; the seam (and protocol) count from 0.\n    position: { line: line - 1, character: character - 1 },\n  }\n}\n\n/** Whether a string is one of the four operations. */\nfunction isOperation(value: string): value is LspOperation {\n  return (LSP_OPERATIONS as readonly string[]).includes(value)\n}\n\n/** Validate a one-based coordinate is a positive integer. */","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/lsp/tool-lsp/src/render.ts#L30-L66","documentation":"Argument validation in the lsp tool: the model supplied an operation value outside the supported set (go-to-definition, find-references, hover, etc., per LSP_OPERATIONS). parseLspArgs rejects unknown operation names before any LSP query is dispatched.","triggerScenarios":"Thrown at packages/lsp/tool-lsp/src/render.ts:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the listed LSP operations."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}