abhigyanpatwari/GitNexus · error · Error

HTTP embedding not configured

Error message

HTTP embedding not configured

What it means

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.

Source

Thrown at gitnexus/src/core/embeddings/http-client.ts:565

  }
  return parsed;
};

/**
 * Embed texts via the HTTP backend, splitting into batches.
 * Reads config from env vars on every call.
 *
 * @param texts - Array of texts to embed
 * @returns Array of Float32Array embedding vectors
 */
export const httpEmbed = async (
  texts: string[],
  requestOptions: EmbeddingRequestOptions = {},
): Promise<Float32Array[]> => {
  if (texts.length === 0) return [];

  const config = readConfig();
  if (!config) throw new Error('HTTP embedding not configured');

  const url = `${config.baseUrl}/embeddings`;
  const allVectors: Float32Array[] = [];

  for (const [batchIndex, batch] of chunk(texts, HTTP_BATCH_SIZE).entries()) {
    const items = await httpEmbedBatch(
      url,
      batch,
      config.model,
      config.apiKey,
      batchIndex,
      config.requestDimensions,
      requestOptions,
      config.maxAttempts,
      config.retryCapMs,
      config.minIntervalMs,
      config.timeoutMs,
    );

View on GitHub (pinned to d540b00184)

Solutions

  1. 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).
  2. Confirm with `node -e "console.log(process.env.GITNEXUS_EMBEDDING_URL, process.env.GITNEXUS_EMBEDDING_MODEL)"` in the indexer's exact environment.
  3. If you did not intend to use HTTP embeddings, disable the embedding step in your indexer configuration rather than calling httpEmbed.
  4. Prefer isHttpMode() as a presence probe before calling httpEmbed — it never throws on a malformed GITNEXUS_EMBEDDING_DIMS.

Example fix

// before
export GITNEXUS_EMBEDDING_URL=https://api.openai.com/v1
# model missing

// after
export GITNEXUS_EMBEDDING_URL=https://api.openai.com/v1
export GITNEXUS_EMBEDDING_MODEL=text-embedding-3-small
Defensive patterns

Strategy: validation

Validate before calling

import { isHttpMode } from 'gitnexus';
// Non-throwing presence probe — use it before calling httpEmbed.
if (!isHttpMode()) {
  throw new Error('HTTP embedding not configured: set GITNEXUS_EMBEDDING_URL and GITNEXUS_EMBEDDING_MODEL');
}

Type guard

// Plain Error; detect by message. Prefer pre-call isHttpMode() instead.
const isNotConfigured = (e: unknown): boolean =>
  e instanceof Error && e.message === 'HTTP embedding not configured';

Try / catch

try {
  await httpEmbed(texts);
} catch (e) {
  if (e instanceof Error && e.message === 'HTTP embedding not configured') {
    // disable the embedding step or set the required env vars
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12). Data as JSON: /api/errors/d050ac0caece2d89. Report an issue: GitHub.