deepseek-ai/deepseek-harness · error

dsh-code-runtime-worker-thread: config.maxOutputBytes must b

Error message

dsh-code-runtime-worker-thread: config.maxOutputBytes must be a safe integer of at least ${MIN_OUTPUT_BYTES}, got ${String(this.config.maxOutputBytes)}

What it means

Beyond the generic positivity pass, the constructor requires maxOutputBytes to be a safe integer of at least MIN_OUTPUT_BYTES (4) — the byte cost of an empty logs array plus an empty JSON failure message, i.e. the smallest cap that can still represent a counted payload.

Source

Thrown at packages/code-runtime/code-runtime-worker-thread/src/index.ts:262

  })

  readonly language = 'typescript'
  readonly isolation = 'worker-thread'

  private readonly config: ResolvedConfig
  private readonly live = new Set<LiveRun>()
  private disposed = false

  constructor(ctx: Context, config: Config) {
    super(ctx)
    // Schemastery filled the defaults; the cast records that. Positivity is a
    // semantic check the schema's plain number type does not carry.
    this.config = config as ResolvedConfig
    for (const [key, value] of Object.entries(this.config)) {
      if (!(Number.isFinite(value) && value > 0)) throw new Error(`dsh-code-runtime-worker-thread: config.${key} must be a positive number, got ${String(value)}`)
    }
    if (!Number.isSafeInteger(this.config.maxOutputBytes) || this.config.maxOutputBytes < MIN_OUTPUT_BYTES) {
      throw new Error(`dsh-code-runtime-worker-thread: config.maxOutputBytes must be a safe integer of at least ${MIN_OUTPUT_BYTES}, got ${String(this.config.maxOutputBytes)}`)
    }
    // maxWallMs reaches setTimeout, which clamps any delay above
    // MAX_TIMER_DELAY_MS to 1 ms; the positivity check above accepts such a
    // value, so a 25-day ceiling would time the run out immediately.
    if (this.config.maxWallMs > MAX_TIMER_DELAY_MS) {
      throw new Error(`dsh-code-runtime-worker-thread: config.maxWallMs must be at most ${MAX_TIMER_DELAY_MS} (Node clamps a longer setTimeout delay to 1ms), got ${String(this.config.maxWallMs)}`)
    }
    ctx.effect(() => () => this.teardown(), 'worker code-runtime teardown')
  }

  /**
   * Dispose to quiescence: mark the service unusable, fail every in-flight
   * run as aborted, and AWAIT each worker's exit so no worker outlives the
   * fiber.
   */
  private async teardown(): Promise<void> {
    this.disposed = true
    const runs = [...this.live]

View on GitHub (pinned to b150a551b8)

Solutions

  1. Set maxOutputBytes to a safe integer of at least 4 (default 67108864 = 64 MiB).
  2. Omit the key to take the default.
  3. Check unit arithmetic for fractional results before writing the value.

Example fix

# before
maxOutputBytes: 1

# after — smallest representable cap, or omit for the 64 MiB default
maxOutputBytes: 4
Defensive patterns

Strategy: validation

Validate before calling

const valid = maxOutputBytes === undefined
  || (Number.isSafeInteger(maxOutputBytes) && maxOutputBytes >= 4)
if (!valid) throw new Error('maxOutputBytes must be a safe integer >= 4')

Type guard

const isValidOutputCap = (v: unknown): v is number =>
  typeof v === 'number' && Number.isSafeInteger(v) && v >= 4

Prevention

When it happens

Trigger: cordis.yml sets maxOutputBytes below 4 (e.g. 1), to a fractional value such as 1024.5, or above Number.MAX_SAFE_INTEGER.

Common situations: Tuning output caps aggressively small to mute program output; fractional values from unit arithmetic; 'unlimited' sentinels past 2^53-1.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/6351cb434c2d64af. Report an issue: GitHub.