deepseek-ai/deepseek-harness · error · MaterializeError

circular references are not JSON data

Error message

circular references are not JSON data

What it means

Realm-materialization guard in the worker runtime: the traversal revisited an object already on its path, i.e. a circular reference. Cycles cannot be serialized to JSON, so materialization fails with the cycle's path.

Solutions

  1. Break circular references in the returned value, e.g. by replacing repeated references with ids.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/workflow/workflow-worker-thread/src/realm.ts:100 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/68396d5cea204549. Report an issue: GitHub.

Appendix: source

Thrown at packages/workflow/workflow-worker-thread/src/realm.ts:100

      return value
    case 'number': {
      if (!Number.isFinite(value)) throw new MaterializeError(path, 'non-finite numbers are not JSON data')
      return value
    }
    case 'bigint':
      throw new MaterializeError(path, 'bigints are not JSON data')
    case 'function':
      throw new MaterializeError(path, 'functions are not plain JSON data')
    case 'symbol':
      throw new MaterializeError(path, 'symbols are not plain JSON data')
    case 'undefined':
      throw new MaterializeError(path, 'undefined is not JSON data')
    case 'object':
      break
  }
  if (value === null) return null
  const objectValue: object = value
  if (seen.has(objectValue)) throw new MaterializeError(path, 'circular references are not JSON data')
  seen.add(objectValue)
  try {
    if (Array.isArray(objectValue)) return materializeArray(objectValue, path, seen)
    return materializeObject(objectValue, path, seen)
  } finally {
    seen.delete(objectValue)
  }
}

function materializeArray(value: unknown[], path: string, seen: Set<object>): unknown[] {
  const out: unknown[] = []
  for (let index = 0; index < value.length; index++) {
    if (!(index in value)) throw new MaterializeError(`${path}[${index}]`, 'sparse arrays are not JSON data')
    out.push(materialize(value[index], `${path}[${index}]`, seen))
  }
  // Own enumerable props beyond the indices (e.g. `arr.total = 3`) would be
  // silently dropped by JSON — reject them instead.
  for (const key of Object.keys(value)) {

View on GitHub (pinned to b150a551b8)