{"record":{"id":"d050ac0caece2d89","repo":"abhigyanpatwari/GitNexus","slug":"http-embedding-not-configured","errorCode":null,"errorMessage":"HTTP embedding not configured","messagePattern":"HTTP embedding not configured","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/embeddings/http-client.ts","lineNumber":565,"sourceCode":"  }\n  return parsed;\n};\n\n/**\n * Embed texts via the HTTP backend, splitting into batches.\n * Reads config from env vars on every call.\n *\n * @param texts - Array of texts to embed\n * @returns Array of Float32Array embedding vectors\n */\nexport const httpEmbed = async (\n  texts: string[],\n  requestOptions: EmbeddingRequestOptions = {},\n): Promise<Float32Array[]> => {\n  if (texts.length === 0) return [];\n\n  const config = readConfig();\n  if (!config) throw new Error('HTTP embedding not configured');\n\n  const url = `${config.baseUrl}/embeddings`;\n  const allVectors: Float32Array[] = [];\n\n  for (const [batchIndex, batch] of chunk(texts, HTTP_BATCH_SIZE).entries()) {\n    const items = await httpEmbedBatch(\n      url,\n      batch,\n      config.model,\n      config.apiKey,\n      batchIndex,\n      config.requestDimensions,\n      requestOptions,\n      config.maxAttempts,\n      config.retryCapMs,\n      config.minIntervalMs,\n      config.timeoutMs,\n    );","sourceCodeStart":547,"sourceCodeEnd":583,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/embeddings/http-client.ts#L547-L583","documentation":"A plain Error thrown by httpEmbed when readConfig() returns null — meaning GITNEXUS_EMBEDDING_URL and/or GITNEXUS_EMBEDDING_MODEL are unset/empty. It is thrown only after a non-empty texts array passes, so the caller asked to embed but the HTTP backend is not configured. This is a configuration error, not an endpoint failure, so it is a plain Error rather than an HttpEmbeddingError.","triggerScenarios":"httpEmbed(texts) called with a non-empty array while either GITNEXUS_EMBEDDING_URL or GITNEXUS_EMBEDDING_MODEL (or both) is unset or empty in the process environment of the indexer.","commonSituations":"Embedding was enabled in the indexer pipeline but the required env vars were not exported in the service/shell that runs `gitnexus analyze`. .env file not loaded. Variable name typo (e.g. GITNEXUS_EMBED_URL). Var set in a different shell than the one running the index.","solutions":["Set both GITNEXUS_EMBEDDING_URL (OpenAI-compatible base, e.g. https://api.openai.com/v1) and GITNEXUS_EMBEDDING_MODEL (e.g. text-embedding-3-small).","Confirm with `node -e \"console.log(process.env.GITNEXUS_EMBEDDING_URL, process.env.GITNEXUS_EMBEDDING_MODEL)\"` in the indexer's exact environment.","If you did not intend to use HTTP embeddings, disable the embedding step in your indexer configuration rather than calling httpEmbed.","Prefer isHttpMode() as a presence probe before calling httpEmbed — it never throws on a malformed GITNEXUS_EMBEDDING_DIMS."],"exampleFix":"// before\nexport GITNEXUS_EMBEDDING_URL=https://api.openai.com/v1\n# model missing\n\n// after\nexport GITNEXUS_EMBEDDING_URL=https://api.openai.com/v1\nexport GITNEXUS_EMBEDDING_MODEL=text-embedding-3-small","handlingStrategy":"validation","validationCode":"import { isHttpMode } from 'gitnexus';\n// Non-throwing presence probe — use it before calling httpEmbed.\nif (!isHttpMode()) {\n  throw new Error('HTTP embedding not configured: set GITNEXUS_EMBEDDING_URL and GITNEXUS_EMBEDDING_MODEL');\n}","typeGuard":"// Plain Error; detect by message. Prefer pre-call isHttpMode() instead.\nconst isNotConfigured = (e: unknown): boolean =>\n  e instanceof Error && e.message === 'HTTP embedding not configured';","tryCatchPattern":"try {\n  await httpEmbed(texts);\n} catch (e) {\n  if (e instanceof Error && e.message === 'HTTP embedding not configured') {\n    // disable the embedding step or set the required env vars\n  }\n  throw e;\n}","preventionTips":["Always gate httpEmbed with isHttpMode() so the call degrades gracefully when unconfigured.","Set both required vars (URL + MODEL) in a single sourced .env.","Validate env at process startup, not at first embed."],"tags":["config","env","embeddings"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}