abhigyanpatwari/GitNexus · warning · Error

optional icebug engine currently requires deterministic thre

Error message

optional icebug engine currently requires deterministic threads=1

What it means

Thrown by runIcebugWorker (community-processor.ts) when the optional icebug community-detection engine is requested but options.icebug.threads is not exactly the integer 1. The deterministic-output guarantee that GitNexus relies on (community IDs feed generated context) requires single-threaded execution; multi-threaded Leiden produces non-reproducible partitions. icebug is an optional native engine — the default engine is Graphology (pure JS Leiden).

Source

Thrown at gitnexus/src/core/ingestion/community-processor.ts:535

    engineRequested,
  };
};

const isIntegerPartition = (partition: ArrayLike<number>): boolean => {
  for (let index = 0; index < partition.length; index++) {
    if (!Number.isSafeInteger(partition[index])) return false;
  }
  return true;
};

const runIcebugWorker = (
  nodeCount: number,
  csr: CommunityCsr,
  options: CommunityDetectionOptions,
): Promise<IcebugWorkerSuccess> => {
  const threads = options.icebug?.threads ?? 1;
  if (!Number.isSafeInteger(threads) || threads !== 1) {
    throw new Error('optional icebug engine currently requires deterministic threads=1');
  }
  if (options.icebug?.randomize === true) {
    throw new Error('optional icebug engine currently requires randomize=false');
  }

  const worker = new Worker(ICEBUG_WORKER_SOURCE, {
    eval: true,
    workerData: {
      nodeCount,
      indices: csr.indices,
      indptr: csr.indptr,
      threads,
      seed: options.icebug?.seed ?? LEIDEN_SEED,
      iterations: options.icebug?.iterations ?? 4,
      gamma: options.icebug?.gamma ?? 1.0,
      randomize: options.icebug?.randomize ?? false,
    },
  });

View on GitHub (pinned to d540b00184)

Solutions

  1. Set icebug.threads to 1 (or omit it — the default is 1) when using the icebug engine.
  2. If you need multi-threaded community detection and don't require reproducibility, note this engine intentionally forbids it — use the default Graphology engine instead, or accept that icebug is gated to threads=1.
  3. Do not retry with the same threads value — this is a deterministic guard, not a transient failure.

Example fix

// before — threads > 1 trips the determinism guard
runIcebugWorker(n, csr, { icebug: { threads: 4, seed: 42 } });

// after — single-threaded, deterministic
runIcebugWorker(n, csr, { icebug: { threads: 1, seed: 42 } });
Defensive patterns

Strategy: validation

Validate before calling

function isDeterministicIcebugConfig(opts: { icebug?: { threads?: unknown } }): boolean {
  const t = opts.icebug?.threads ?? 1;
  return Number.isSafeInteger(t) && t === 1;
}
// before calling community detection with engine:'icebug':
if (!isDeterministicIcebugConfig(options)) {
  throw new Error('icebug requires threads=1; refusing non-deterministic config');
}

Type guard

function isIcebugThreads1(v: unknown): v is 1 {
  return Number.isSafeInteger(v) && v === 1;
}

Prevention

When it happens

Trigger: Configuring community detection with engine: 'icebug' and icebug.threads set to 2 or more; threads set to a non-integer (e.g. 1.5); threads set to 0 or a negative number.

Common situations: Operator copied an icebug config from docs/examples that suggested threads > 1 for speed; a config file left threads unset incorrectly via a non-integer; experimenting with the optional engine without reading the determinism constraint.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12). Data as JSON: /api/errors/f4bd7e5d5125c42d. Report an issue: GitHub.