deepseek-ai/deepseek-harness · error

dsh-code-runtime-worker-thread: config.${key} must be a posi

Error message

dsh-code-runtime-worker-thread: config.${key} must be a positive number, got ${String(value)}

What it means

WorkerThreadCodeRuntime's constructor validates every config field (computeMs, maxWallMs, maxOutputBytes, maxOldGenerationSizeMb — schemastery fills defaults first) and rejects any that is not a finite positive number. The schema types these as plain numbers, so positivity is a semantic check only the constructor can make; it fires at plugin load and names the first offending key.

Source

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

    maxWallMs: z.number().default(600_000),
    maxOutputBytes: z.number().default(67_108_864),
    maxOldGenerationSizeMb: z.number().default(512),
  })

  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.
   */

View on GitHub (pinned to b150a551b8)

Solutions

  1. Set the named config.<key> to a finite positive number (units: computeMs and maxWallMs in milliseconds, maxOutputBytes in bytes, maxOldGenerationSizeMb in MiB).
  2. To express 'use the default', omit the key instead of writing 0.
  3. If config is generated, print the rendered cordis.yml and look for NaN, Infinity, or empty values.

Example fix

# before — 0 does not mean 'unlimited'; it fails the positivity check
computeMs: 0

# after — omit for the 60000 ms default, or give a positive budget
computeMs: 120000
Defensive patterns

Strategy: validation

Validate before calling

const caps = { computeMs, maxWallMs, maxOutputBytes, maxOldGenerationSizeMb }
for (const [key, value] of Object.entries(caps)) {
  if (value !== undefined && !(Number.isFinite(value) && value > 0)) {
    throw new Error(`rejecting cordis.yml before load: ${key}=${String(value)} is not a positive number`)
  }
}

Type guard

const isPositiveCap = (v: unknown): v is number =>
  typeof v === 'number' && Number.isFinite(v) && v > 0

Prevention

When it happens

Trigger: cordis.yml sets any of the four caps to 0, a negative number, Infinity, or NaN — for example computeMs: 0 or maxOldGenerationSizeMb: -1.

Common situations: Trying to express 'no limit' with 0 (not supported — omit the key to take the default); templated or computed config producing NaN/Infinity; unit mistakes (seconds vs milliseconds) yielding values that fail the check.

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/28d301b0abf9bffe. Report an issue: GitHub.