{"record":{"id":"01cc46bd2d59124d","repo":"abhigyanpatwari/GitNexus","slug":"gitnexus-embedding-request-dims-must-be-a-positive","errorCode":null,"errorMessage":"GITNEXUS_EMBEDDING_REQUEST_DIMS must be a positive integer, got \"${rawRequestDims}\"","messagePattern":"GITNEXUS_EMBEDDING_REQUEST_DIMS must be a positive integer, got \"(.+?)\"","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/embeddings/http-client.ts","lineNumber":176,"sourceCode":"  if (rawDims !== undefined) {\n    if (!/^\\d+$/.test(rawDims)) {\n      throw new Error(`${EMBEDDING_DIMS_ENV_ERROR_LEAD}, got \"${rawDims}\"`);\n    }\n    const parsed = parseInt(rawDims, 10);\n    if (parsed <= 0) {\n      throw new Error(`${EMBEDDING_DIMS_ENV_ERROR_LEAD}, got \"${rawDims}\"`);\n    }\n    dimensions = parsed;\n  }\n\n  const rawRequestDims = process.env.GITNEXUS_EMBEDDING_REQUEST_DIMS?.trim();\n  let requestDimensions = dimensions;\n  if (rawRequestDims) {\n    if (/^(omit|none|off|false|0)$/i.test(rawRequestDims)) {\n      requestDimensions = undefined;\n    } else {\n      if (!/^\\d+$/.test(rawRequestDims)) {\n        throw new Error(`${EMBEDDING_REQUEST_DIMS_ENV_ERROR_LEAD}, got \"${rawRequestDims}\"`);\n      }\n      const parsed = parseInt(rawRequestDims, 10);\n      if (parsed <= 0) {\n        throw new Error(`${EMBEDDING_REQUEST_DIMS_ENV_ERROR_LEAD}, got \"${rawRequestDims}\"`);\n      }\n      requestDimensions = parsed;\n    }\n  }\n\n  return {\n    baseUrl: baseUrl.replace(/\\/+$/, ''),\n    model,\n    apiKey: process.env.GITNEXUS_EMBEDDING_API_KEY ?? 'unused',\n    dimensions,\n    maxAttempts: parsePositiveIntegerEnv(\n      'GITNEXUS_EMBEDDING_MAX_ATTEMPTS',\n      HTTP_MAX_RETRIES + 1,\n      20,","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/ac9a4e9abd8fd3058c070b72c23402a4f887929a/gitnexus/src/core/embeddings/http-client.ts#L158-L194","documentation":"readConfig() validates GITNEXUS_EMBEDDING_REQUEST_DIMS — the dimensions parameter sent in each request body (for endpoints supporting Matryoshka truncation). It is optional: the sentinel values omit/none/off/false/0 (case-insensitive) suppress the parameter; anything else must be pure digits. Non-digit values throw with EMBEDDING_REQUEST_DIMS_ENV_ERROR_LEAD.","triggerScenarios":"GITNEXUS_EMBEDDING_REQUEST_DIMS='half', '768.0', '-1', or 'true' (note: bare '0' is a legal alias for omit and does NOT throw) while HTTP embedding mode is configured.","commonSituations":"Confusing this knob with GITNEXUS_EMBEDDING_DIMS (declared dims) and setting a non-numeric sentinel the parser doesn't know; copy-paste from provider docs describing truncation ratios.","solutions":["Use a plain integer (GITNEXUS_EMBEDDING_REQUEST_DIMS=256) or one of the omit sentinels (omit/none/off/false/0).","Unset the variable to inherit GITNEXUS_EMBEDDING_DIMS.","Keep the declared dims and request dims consistent to avoid vector-length mismatches at the DB layer."],"exampleFix":"# before\nexport GITNEXUS_EMBEDDING_REQUEST_DIMS='none-needed'\n# after\nexport GITNEXUS_EMBEDDING_REQUEST_DIMS=none   # or unset it","handlingStrategy":"validation","validationCode":"const rd = process.env.GITNEXUS_EMBEDDING_REQUEST_DIMS?.trim();\nif (rd && !/^(omit|none|off|false|0)$/i.test(rd) && !/^\\d+$/.test(rd)) {\n  throw new Error('GITNEXUS_EMBEDDING_REQUEST_DIMS must be an integer or an omit sentinel');\n}","typeGuard":"const isRequestDimsEnvError = (e: unknown): boolean =>\n  e instanceof Error && e.message.includes('GITNEXUS_EMBEDDING_REQUEST_DIMS must be');","tryCatchPattern":"try {\n  await httpEmbed(texts);\n} catch (e) {\n  if (isRequestDimsEnvError(e)) { /* fix/unset REQUEST_DIMS; non-retryable */ }\n  else throw e;\n}","preventionTips":["Use omit/none/off/false/0 exactly to suppress the request dims — they are case-insensitive but exact-match.","Keep GITNEXUS_EMBEDDING_DIMS (declared) and REQUEST_DIMS (per-request truncation) roles straight."],"tags":["embeddings","environment-variable","dimensions","validation","http"],"backgroundTag":"invalid-env-var","analyzedSha":"ac9a4e9abd8fd3058c070b72c23402a4f887929a","analyzedAt":"2026-08-20T23:29:22.980Z","contentChangedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}