{"record":{"id":"029ddd793ee7bb97","repo":"abhigyanpatwari/GitNexus","slug":"optional-icebug-build-predates-the-deterministic-t","errorCode":null,"errorMessage":"optional icebug build predates the deterministic thread/seed controls (icebug-nodejs#6)","messagePattern":"optional icebug build predates the deterministic thread/seed controls \\(icebug-nodejs#6\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"gitnexus/src/core/ingestion/community-processor.ts","lineNumber":620,"sourceCode":" * + index.d.ts): `GraphR(n, directed, outIndices, outIndptr)` pins the CSR\n * buffers zero-copy, and `Leiden(graph, iterations, randomize, gamma)` — note\n * `randomize` precedes `gamma` — returns `{membership, count}` from\n * `getPartition()`.\n *\n * The thread/seed controls are required, not optional: community IDs feed\n * generated context, so a build without them would give non-reproducible\n * output. They exist at icebug-nodejs HEAD but are missing from the published\n * 12.8.0 tarball, so today this guard is what trips and sends us back to\n * Graphology.\n */\nexport const buildIcebugWorkerSource = (moduleSpecifier: string): string => `\nconst { parentPort, workerData } = require('node:worker_threads');\n\ntry {\n  const icebug = require(${JSON.stringify(moduleSpecifier)});\n\n  if (typeof icebug.setNumberOfThreads !== 'function' || typeof icebug.setSeed !== 'function') {\n    throw new Error(\n      'optional icebug build predates the deterministic thread/seed controls (icebug-nodejs#6)',\n    );\n  }\n\n  icebug.setNumberOfThreads(workerData.threads);\n  icebug.setSeed(workerData.seed, false);\n\n  const graph = new icebug.GraphR(\n    workerData.nodeCount,\n    false,\n    workerData.indices,\n    workerData.indptr,\n  );\n  const leiden = new icebug.Leiden(\n    graph,\n    workerData.iterations,\n    workerData.randomize,\n    workerData.gamma,","sourceCodeStart":602,"sourceCodeEnd":638,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/ingestion/community-processor.ts#L602-L638","documentation":"Thrown inside the icebug worker script (generated by buildIcebugWorkerSource) when the loaded icebug native module does not export setNumberOfThreads and setSeed as functions. These are the deterministic thread/seed controls required for reproducible output; they exist at icebug-nodejs HEAD but are missing from the published 12.8.0 tarball. The message references icebug-nodejs#6. This throw happens inside the worker and is posted back as {ok:false, error:...}, then rejected by runIcebugWorker's message handler — which is expected to trip the Graphology fallback.","triggerScenarios":"The icebug engine is requested and the installed @ladybugmem/icebug version is 12.8.0 (or another build predating the setNumberOfThread/setSeed additions). The worker loads the module, finds the functions absent, and throws.","commonSituations":"An operator opted into the optional icebug engine without checking version compatibility; an npm install resolved to the published 12.8.0 tarball; the native dependency was bumped to a version still missing the controls.","solutions":["This is the expected path for published 12.8.0 — the system falls back to the default Graphology engine. No action is strictly required unless you specifically need icebug.","To actually use icebug, install a build from icebug-nodejs HEAD that includes setNumberOfThreads/setSeed (post icebug-nodejs#6).","If you don't need icebug, switch the engine config back to the default (omit engine: 'icebug') to avoid the worker spin-up that always fails on 12.8.0.","Watch for an icebug npm release newer than 12.8.0 that ships the controls."],"exampleFix":"// before — requesting icebug against published 12.8.0 (always trips this guard)\n{ communityDetection: { engine: 'icebug' } }\n\n// after — use the default deterministic Graphology engine\n{ communityDetection: { engine: 'graphology' } } // or omit engine entirely","handlingStrategy":"fallback","validationCode":"// Probe the installed icebug module for the required controls before\n// requesting the engine:\nfunction icebugHasDeterministicControls(icebug: unknown): boolean {\n  return typeof (icebug as Record<string, unknown> | null)?.setNumberOfThreads === 'function' &&\n    typeof (icebug as Record<string, unknown> | null)?.setSeed === 'function';\n}\n// if false, fall back to engine:'graphology' instead of requesting 'icebug'.","typeGuard":"function icebugSupportsDeterminism(mod: unknown): mod is { setNumberOfThreads: (n: number) => void; setSeed: (s: number, r: boolean) => void } {\n  return typeof (mod as Record<string, unknown> | null)?.setNumberOfThreads === 'function' &&\n    typeof (mod as Record<string, unknown> | null)?.setSeed === 'function';\n}","tryCatchPattern":"// runIcebugWorker already rejects this and is expected to fall back to Graphology.\n// At the caller, catch and degrade:\ntry { result = await detectCommunitiesIcebug(...); }\ncatch (err) {\n  logger.warn({ msg: (err as Error).message }, 'icebug unavailable — using Graphology');\n  result = await detectCommunitiesGraphology(...);\n}","preventionTips":["Prefer the default Graphology engine unless you specifically need icebug.","If you need icebug, install from icebug-nodejs HEAD (post #6) rather than published 12.8.0.","Wrap the icebug call path in a Graphology fallback so a version mismatch degrades gracefully."],"tags":["icebug","native-dependency","version-mismatch","community-detection","ingestion"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}