abhigyanpatwari/GitNexus · error · HttpEmbeddingError

Embedding endpoint circuit open (${safeUrl(url)}, batch ${ba

Error message

Embedding endpoint circuit open (${safeUrl(url)}, batch ${batchIndex}): retry in ${Math.ceil(err.retryAfterMs / 1000)}s

What it means

An HttpEmbeddingError thrown from httpEmbedBatch's catch block when resilientFetch raises a CircuitOpenError — the in-process circuit breaker for the shared key `embeddings-http` is open because the endpoint has been failing repeatedly. The breaker fails fast instead of issuing another request, and the message reports how long until the breaker half-opens (Math.ceil(retryAfterMs/1000) seconds). This protects the indexer from hammering a down endpoint.

Source

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

    );
  } catch (err) {
    if (
      requestOptions.signal?.aborted ||
      (err instanceof DOMException && err.name === 'AbortError')
    ) {
      throw new HttpEmbeddingError(
        `Embedding request cancelled (${safeUrl(url)}, batch ${batchIndex})`,
        { cause: err },
      );
    }
    // Retries are exhausted on a bad 2xx body. Surface the message the sentinel
    // carried, keeping the underlying parse error in `cause` only — the body
    // text must never reach the `sanitizeReason` fallback and leak to stderr.
    if (err instanceof RetryableEmbeddingBodyError) {
      throw new HttpEmbeddingError(err.terminalMessage, { cause: err.cause });
    }
    if (err instanceof CircuitOpenError) {
      throw new HttpEmbeddingError(
        `Embedding endpoint circuit open (${safeUrl(url)}, batch ${batchIndex}): retry in ${Math.ceil(err.retryAfterMs / 1000)}s`,
        { cause: err },
      );
    }
    if (err instanceof DOMException && err.name === 'TimeoutError') {
      throw new HttpEmbeddingError(
        `Embedding request timed out after ${timeoutMs}ms (${safeUrl(url)}, batch ${batchIndex})`,
        { cause: err },
      );
    }
    if (err instanceof ResilientFetchExhaustedError) {
      throw new HttpEmbeddingError(
        `Embedding endpoint returned ${err.response.status} (${safeUrl(url)}, batch ${batchIndex})`,
        { cause: err },
      );
    }
    const reason = sanitizeReason(err instanceof Error ? err.message : String(err), url, apiKey);
    const safeCause = new Error(reason);

View on GitHub (pinned to d540b00184)

Solutions

  1. Wait for the reported retry window to elapse, then retry — the breaker will half-open and probe the endpoint.
  2. Fix the underlying endpoint fault (the breaker opened for a reason): check connectivity, auth, model name, and provider status.
  3. If you must reset immediately for testing, restart the indexer process (the breaker is in-process, keyed `embeddings-http`).
  4. Reduce the failure rate by increasing GITNEXUS_EMBEDDING_RETRY_CAP_MS / GITNEXUS_EMBEDDING_MAX_ATTEMPTS so transient blips do not accumulate into a trip.
Defensive patterns

Strategy: retry

Validate before calling

// Cannot prevent a breaker trip from the caller, but you can avoid tripping it:
// validate reachability and rate-limit before the run (see errors 130/131 probes).

Type guard

import { isHttpEmbeddingError } from 'gitnexus';
const isCircuitOpen = (e: unknown): boolean =>
  isHttpEmbeddingError(e) && e instanceof Error && e.message.includes('circuit open');

Try / catch

// Wait out the reported window, then retry once. Do not busy-loop.
try {
  await httpEmbed(texts);
} catch (e) {
  if (isCircuitOpen(e)) {
    const secs = parseInt(/retry in (\d+)s/.exec(e.message)?.[1] ?? '0', 10);
    await new Promise(r => setTimeout(r, (secs + 1) * 1000));
    // retry once; if it trips again, the endpoint is still down — back off further
  } else throw e;
}

Prevention

When it happens

Trigger: httpEmbedBatch called while the `embeddings-http` circuit breaker is open, which happens after a configured run of consecutive/recent failures (from any combination of retryable body errors, 5xx/429, timeouts, or network errors) within the breaker's window. Subsequent batches in the same process hit this fast-fail path until retryAfterMs elapses.

Common situations: Endpoint is down or returning 5xx; the first few batches exhausted retries and tripped the breaker; all remaining batches in the run then fail fast with this message. Restarting the process resets the in-process breaker, which can mask the issue temporarily.

Related errors


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