{"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":620,"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      config.retryTimeouts,","sourceCodeStart":602,"sourceCodeEnd":638,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/ac9a4e9abd8fd3058c070b72c23402a4f887929a/gitnexus/src/core/embeddings/http-client.ts#L602-L638","documentation":"Plain Error thrown by httpEmbed() when readConfig() returns null, which happens whenever either GITNEXUS_EMBEDDING_URL or GITNEXUS_EMBEDDING_MODEL is unset. Both env vars are required to activate HTTP embedding mode; the API key defaults to 'unused' so it is never the trigger. Config is re-read from env on every call, so the check reflects the environment at call time.","triggerScenarios":"Invoking httpEmbed(texts) with a non-empty array while GITNEXUS_EMBEDDING_URL or GITNEXUS_EMBEDDING_MODEL is missing from process.env — e.g. the .env file was not loaded, the var was exported in a different shell, or CI masked one of the two names.","commonSituations":"Setting only GITNEXUS_EMBEDDING_URL because the local server ignores the model field; typos in the env var name (GITNEXUS_EMBEDDINGS_URL); dotenv file not loaded before the embedding call; CI secrets naming the vars differently than the documented pair.","solutions":["Set both required vars: export GITNEXUS_EMBEDDING_URL=http://localhost:11434/v1 and export GITNEXUS_EMBEDDING_MODEL=<model-id>.","Verify with the library's own probe: node -e \"console.log(require('./dist/core/embeddings/http-client.js').isHttpMode())\" should print true.","Check spelling of both env var names and that the shell/CI actually exports them into the process running gitnexus.","If you intended local embeddings, unset both vars so the ONNX embedder path is used instead of httpEmbed."],"exampleFix":"# before\nexport GITNEXUS_EMBEDDING_URL=http://localhost:11434/v1\ngitnexus analyze  # -> Error: HTTP embedding not configured (model missing)\n\n# after\nexport GITNEXUS_EMBEDDING_URL=http://localhost:11434/v1\nexport GITNEXUS_EMBEDDING_MODEL=nomic-embed-text\ngitnexus analyze","handlingStrategy":"validation","validationCode":"import { isHttpMode } from './core/embeddings/http-client.js';\n\n// Call before httpEmbed(): both vars are required for HTTP embedding mode.\nexport function assertHttpEmbeddingConfigured(): void {\n  if (!isHttpMode()) {\n    const missing = [\n      !process.env.GITNEXUS_EMBEDDING_URL && 'GITNEXUS_EMBEDDING_URL',\n      !process.env.GITNEXUS_EMBEDDING_MODEL && 'GITNEXUS_EMBEDDING_MODEL',\n    ].filter(Boolean);\n    throw new Error(`HTTP embedding requires both env vars; missing: ${missing.join(', ')}`);\n  }\n}","typeGuard":"// Pure presence probe — mirrors the library's own isHttpMode() logic.\nexport const isHttpEmbeddingConfigured = (): boolean =>\n  Boolean(process.env.GITNEXUS_EMBEDDING_URL && process.env.GITNEXUS_EMBEDDING_MODEL);","tryCatchPattern":"try {\n  vectors = await httpEmbed(texts);\n} catch (err) {\n  if (err instanceof Error && err.message === 'HTTP embedding not configured') {\n    // Config problem, not data: point at the env vars or switch embedder.\n    throw new Error('Set GITNEXUS_EMBEDDING_URL and GITNEXUS_EMBEDDING_MODEL (or unset both to use the local embedder)', { cause: err });\n  }\n  throw err;\n}","preventionTips":["Set both GITNEXUS_EMBEDDING_URL and GITNEXUS_EMBEDDING_MODEL together in the same env file — one without the other is always a bug.","Call isHttpMode() at startup to fail fast with a precise message instead of deep inside an embedding loop.","In CI, assert isHttpMode() is true in jobs that need HTTP embeddings, and false in jobs that must not touch the network."],"tags":["configuration","env-vars","embeddings"],"backgroundTag":"missing-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"}