deepseek-ai/deepseek-harness · error

operation must be one of

Error message

operation must be one of ${LSP_OPERATIONS.join(', ')}

What it means

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.

Solutions

  1. Use one of the listed LSP operations.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/lsp/tool-lsp/src/render.ts:48 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/2b0c4b8308e0f46f. Report an issue: GitHub.

Appendix: source

Thrown at packages/lsp/tool-lsp/src/render.ts:48

/** The raw, schema-typed argument shape. */
export interface LspToolArgs {
  readonly operation: string
  readonly file_path: string
  readonly line: number
  readonly character: number
}

/**
 * Validate and convert model arguments: `operation` must be one of the four; `line`/`character` are
 * positive one-based integers converted to the seam's zero-based position.
 * @param args - the schema-validated raw arguments.
 * @returns the validated input with a zero-based position.
 * @throws Error when the operation is unknown or a coordinate is not a positive integer.
 */
export function parseLspArgs(args: LspToolArgs): LspToolInput {
  if (!isOperation(args.operation)) {
    throw new Error(`operation must be one of ${LSP_OPERATIONS.join(', ')}`)
  }
  if (args.file_path.trim().length === 0) throw new Error('file_path must be a non-empty string')
  const line = oneBased(args.line, 'line')
  const character = oneBased(args.character, 'character')
  return {
    operation: args.operation,
    filePath: args.file_path,
    // The model counts from 1; the seam (and protocol) count from 0.
    position: { line: line - 1, character: character - 1 },
  }
}

/** Whether a string is one of the four operations. */
function isOperation(value: string): value is LspOperation {
  return (LSP_OPERATIONS as readonly string[]).includes(value)
}

/** Validate a one-based coordinate is a positive integer. */

View on GitHub (pinned to b150a551b8)