deepseek-ai/deepseek-harness · error · Error

harness.handle(method, fn) needs a non-empty string method n

Error message

harness.handle(method, fn) needs a non-empty string method name

What it means

Error "harness.handle(method, fn) needs a non-empty string method name" thrown in deepseek-ai/deepseek-harness.

Source

Thrown at packages/extensions/cordis-host-runner/src/guard.ts:606

  return markDynamicTool({
    ...tool,
    parameters,
  })
}

/**
 * Normalize one `harness.handle` registration at the sandbox boundary: the
 * method name must be a non-empty string and the handler a function whose
 * result is host-materialized through the same cross-realm JSON clone as tool
 * `execute` returns (a VM-realm object would otherwise escape the wire's
 * plain-object contract).
 * @param method - handler name the package's browser half calls through `host.call`.
 * @param fn - sandbox handler receiving the wire-decoded JSON arguments.
 * @returns the validated name and the clone-wrapped handler.
 */
export function normalizeHandler(method: unknown, fn: unknown): { method: string; handler: (args: unknown) => Promise<unknown> } {
  if (typeof method !== 'string' || method.length === 0) {
    throw new Error('harness.handle(method, fn) needs a non-empty string method name')
  }
  if (typeof fn !== 'function') {
    throw new Error(`harness.handle("${method}") needs a handler function as its second argument`)
  }
  const rawHandler = fn as (args: unknown) => unknown
  return {
    method,
    handler: async (args: unknown): Promise<unknown> =>
      cloneJson(await rawHandler(args), `harness.handle("${method}") result`),
  }
}

/**
 * The `harness.registerTool` handed into the sandbox: registers a
 * marker-verified dynamic tool on the given context's registry.
 * @param ctx - the (guarded) context whose `tools` service receives the tool.
 * @param tool - a definition produced by {@link sandboxDefineTool}; anything else is rejected.
 * @returns the registry disposer for the registration.

View on GitHub (pinned to b150a551b8)

When it happens

Trigger: Thrown at packages/extensions/cordis-host-runner/src/guard.ts:606 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/ff93cb5e58db9c9f. Report an issue: GitHub.