abhigyanpatwari/GitNexus · error · HttpEmbeddingError

after attempt(s) ( , batch )

Error message

${err.message} after ${maxAttempts} attempt(s) (${safeUrl(url)}, batch ${batchIndex})

What it means

When every attempt of the HTTP embed request times out (RetryableEmbeddingTimeoutError), httpEmbedBatch throws HttpEmbeddingError with a message of the timeout error plus 'after <maxAttempts> attempt(s) (<safeUrl>, batch <batchIndex>)'. The original timeout cause is kept in cause. It tells you which batch of which URL timed out and how many attempts were made.

Solutions

  1. Check the embedding server is up and responsive (health endpoint) and scale/restart it if overloaded.
  2. Increase the client's per-request timeout to suit batch size and model latency.
  3. Reduce batch size so each request completes well within the timeout.
  4. Check network path latency to safeUrl; test with curl from the same host.
  5. Verify the endpoint URL is correct — a wrong host that blackholes packets will always time out.

Example fix

// before: tight timeout, big batches
await httpEmbedBatch(items, { timeoutMs: 2000, batchSize: 128 });
// after: realistic timeout, smaller batches
await httpEmbedBatch(items, { timeoutMs: 30000, batchSize: 32 });
Defensive patterns

Strategy: retry

Validate before calling

// cheap reachability probe before large batch runs
const ctrl = new AbortController();
const t = setTimeout(() => ctrl.abort(), 5000);
const probe = await fetch(healthUrl, { signal: ctrl.signal }).catch(() => null);
clearTimeout(t);
if (!probe || !probe.ok) throw new Error('embedding endpoint unreachable/slow');

Try / catch

try {
  vectors = await httpEmbedBatch(items, { timeoutMs: 30000 });
} catch (e) {
  if (e instanceof HttpEmbeddingError && /after \d+ attempt/.test(e.message)) {
    await backoff(1000);
    vectors = await httpEmbedBatch(smaller(items), { timeoutMs: 60000 });
  } else throw e;
}

Prevention

When it happens

Trigger: The embedding HTTP endpoint accepts the connection but does not respond within the per-attempt timeout, for all configured attempts, during httpEmbedBatch for batchIndex.

Common situations: Embedding server overloaded or stuck on a huge batch; too-short client timeout for large inputs; slow network/VPN to a remote embedding API; server-side cold start or model reload hanging requests.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@ac9a4e9abd (2026-09-15). Data as JSON: /api/errors/49e878948acd31fd. Report an issue: GitHub.

Appendix: source

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

    );
  } 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 RetryableEmbeddingTimeoutError) {
      throw new HttpEmbeddingError(
        `${err.message} after ${maxAttempts} attempt(s) (${safeUrl(url)}, batch ${batchIndex})`,
        { 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(

View on GitHub (pinned to ac9a4e9abd)