deepseek-ai/deepseek-harness · error · ToolArgsError

INVALID_ARGS

INVALID_ARGS

Error message

invalid arguments: ${violations.join('; ')}

What it means

Argument validation inside the generated tool definition: the runtime arguments object fails schema validation at execution time, with each violation itemized. This is the standard invalid-arguments rejection the model sees when its call does not match the tool's parameter schema.

Solutions

  1. Match each argument to the tool's declared parameter schema (types, required fields)
  2. Fix enum/format mismatches listed in the violations
  3. Tighten or correct the tool description so the model supplies valid arguments
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/core/tools/src/schema.ts:587 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/4afeb3688b37f1be. Report an issue: GitHub.

Appendix: source

Thrown at packages/core/tools/src/schema.ts:587

  const tool: ToolDefinition = {
    name: options.name,
    description: options.description,
    parameters: parameters as unknown as Record<string, unknown>,
    output: {
      schema: outputSchema,
      render(args: unknown, value: JsonValue): ContentBlock[] {
        return userRender(args as InferArgs<S>, value as unknown as InferValue<NoInfer<O>>)
      },
      ...userPresentationMeta !== undefined ? {
        presentationMeta(args: unknown, value: JsonValue): JsonValue {
          return userPresentationMeta(args as InferArgs<S>, value as unknown as InferValue<NoInfer<O>>)
        },
      } : {},
    },
    ...(options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {}),
    async execute(args: unknown, exec: ToolRunContext): Promise<JsonValue> {
      const violations = validate(args)
      if (violations.length > 0) throw new ToolArgsError(violations)
      return userExecute(args as InferArgs<S>, exec) as Promise<JsonValue>
    },
  }
  if (userFinalizeContent) {
    tool.finalizeContent = (exec, result) => userFinalizeContent(exec, result)
  }
  // Presentation is display-only and may run on REPLAY of arbitrary logged args
  // (possibly from an older schema), so it must never throw: validate softly and
  // fall back to `undefined` (a generic UI presentation) on any mismatch, rather
  // than the hard `ToolArgsError` the execute path raises.
  if (userPresentCall) {
    tool.presentCall = (args: unknown): ToolCallView | undefined => {
      if (validate(args).length > 0) return undefined
      return userPresentCall(args as InferArgs<S>)
    }
  }
  if (userPresentResult) {
    tool.presentResult = (args: unknown, result: ToolResult): ToolResultView | undefined => {

View on GitHub (pinned to b150a551b8)