{"record":{"id":"2c6eae6a25365ed5","repo":"abhigyanpatwari/GitNexus","slug":"checkpointeverynodes-must-be-a-positive-integer","errorCode":null,"errorMessage":"checkpointEveryNodes must be a positive integer","messagePattern":"checkpointEveryNodes must be a positive integer","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/embeddings/embedding-pipeline.ts","lineNumber":544,"sourceCode":" *        and re-embedded; nodes not in the map are embedded fresh.\n */\nexport const runEmbeddingPipeline = async (\n  executeQuery: (cypher: string) => Promise<any[]>,\n  executeWithReusedStatement: (\n    cypher: string,\n    paramsList: Array<Record<string, any>>,\n  ) => Promise<void>,\n  onProgress: EmbeddingProgressCallback,\n  config: Partial<EmbeddingConfig> = {},\n  skipNodeIds?: Set<string>,\n  existingEmbeddings?: Map<string, string>,\n  pipelineOptions: EmbeddingPipelineOptions = {},\n): Promise<EmbeddingPipelineResult> => {\n  const finalConfig = resolveEmbeddingConfig(config);\n  let totalChunks = 0;\n  const checkpointEveryNodes = pipelineOptions.checkpointEveryNodes ?? 5_000;\n  if (!Number.isSafeInteger(checkpointEveryNodes) || checkpointEveryNodes <= 0) {\n    throw new Error('checkpointEveryNodes must be a positive integer');\n  }\n  const throwIfCancelled = (): void => pipelineOptions.signal?.throwIfAborted();\n\n  try {\n    throwIfCancelled();\n    const vectorAvailable = await ensureVectorExtensionAvailable();\n    throwIfCancelled();\n    if (!vectorAvailable) {\n      logger.warn(vectorUnavailableMessage);\n    }\n\n    // Phase 1: Load embedding model\n    onProgress({\n      phase: 'loading-model',\n      percent: 0,\n      modelDownloadPercent: 0,\n    });\n","sourceCodeStart":526,"sourceCodeEnd":562,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/embeddings/embedding-pipeline.ts#L526-L562","documentation":"Thrown by runEmbeddingPipeline() when pipelineOptions.checkpointEveryNodes is present and is not a safe positive integer. The value (default 5000) controls how often the pipeline checkpoints progress by interleaving DELETE-then-INSERT batches; a non-integer, zero, negative, or beyond-MAX_SAFE_INTEGER value would produce malformed batch boundaries or skip checkpointing entirely.","triggerScenarios":"Programmatic callers of runEmbeddingPipeline passing pipelineOptions.checkpointEveryNodes as a float (e.g. 500.5), a string ('5000'), zero, or a negative number. The CLI does not expose this option, so it is almost always a custom integration or a test harness.","commonSituations":"A wrapper script passing a computed checkpoint interval that evaluated to a float; passing a value read from a config file as a string; a test using 0 to disable checkpointing (use a very large value instead).","solutions":["Pass checkpointEveryNodes as a positive integer, e.g. { checkpointEveryNodes: 5000 }.","Omit the option to accept the 5000-node default.","To effectively disable checkpointing for a small run, pass a value larger than the expected node count rather than 0."],"exampleFix":"// before\nawait runEmbeddingPipeline(eq, ex, onProgress, {}, undefined, undefined, {\n  checkpointEveryNodes: 0,\n});\n// after\nawait runEmbeddingPipeline(eq, ex, onProgress, {}, undefined, undefined, {\n  checkpointEveryNodes: 100_000,\n});","handlingStrategy":"validation","validationCode":"const assertCheckpoint = (v: unknown): void => {\n  if (v !== undefined && (!Number.isSafeInteger(v as number) || (v as number) <= 0)) {\n    throw new Error('pipelineOptions.checkpointEveryNodes must be a positive integer (omit for 5000 default).');\n  }\n};\nassertCheckpoint(pipelineOptions.checkpointEveryNodes);","typeGuard":"const isPositiveSafeInteger = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isSafeInteger(v) && v > 0;","tryCatchPattern":null,"preventionTips":["Omit checkpointEveryNodes to accept the 5000-node default.","Never pass 0 to disable checkpointing — use a large value instead.","Pass integers, not strings or floats."],"tags":["embeddings","pipeline","validation","config"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}