abhigyanpatwari/GitNexus · info · HttpEmbeddingError
Embedding request cancelled (${safeUrl(url)}, batch ${batchI
Error message
Embedding request cancelled (${safeUrl(url)}, batch ${batchIndex}) What it means
An HttpEmbeddingError thrown from httpEmbedBatch's catch block when the caller's AbortSignal is aborted (or the error is a DOMException AbortError). It is a clean, terminal wrapping of a user-initiated cancellation — not a failure. The message includes the safe URL and batch index for context, and the original abort error is preserved in `cause`.
Source
Thrown at gitnexus/src/core/embeddings/http-client.ts:495
parsed = payload.data;
return attemptResp;
},
breakerKey: HTTP_BREAKER_KEY,
retry: {
maxAttempts,
baseDelayMs: HTTP_RETRY_BACKOFF_MS,
capDelayMs: retryCapMs,
retryAfterCapMs: retryCapMs,
sleep: (ms) => abortableSleep(ms, requestOptions.signal),
},
},
);
} 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(View on GitHub (pinned to d540b00184)
Solutions
- Treat this as expected, not an error: if you aborted on purpose, no fix is needed — log it at info/debug level and exit cleanly.
- If it fires unexpectedly, find the caller that calls controller.abort() on the signal you passed in (EmbeddingRequestOptions.signal).
- Pass a fresh, unshared AbortSignal per embed call if a shared signal is being aborted by an unrelated operation.
- Increase GITNEXUS_EMBEDDING_HTTP_TIMEOUT_MS if the abort is actually a timeout misattributed as cancellation (though true timeouts surface as error 129).
Example fix
// before: a shared controller is aborted elsewhere
const shared = new AbortController();
// ... other code calls shared.abort() ...
await httpEmbed(texts, { signal: shared.signal });
// after: dedicated signal per embed call
const embedCtl = new AbortController();
await httpEmbed(texts, { signal: embedCtl.signal }); Defensive patterns
Strategy: try-catch
Validate before calling
// Pass a dedicated, unshared signal and only abort it intentionally.
const ctl = new AbortController();
// ... if you really must cancel: ctl.abort();
await httpEmbed(texts, { signal: ctl.signal }); Type guard
import { isHttpEmbeddingError } from 'gitnexus';
const isCancelled = (e: unknown): boolean =>
isHttpEmbeddingError(e) && e instanceof Error && e.message.startsWith('Embedding request cancelled'); Try / catch
try {
await httpEmbed(texts, { signal: ctl.signal });
} catch (e) {
if (isHttpEmbeddingError(e) && e.message.includes('request cancelled')) {
// user-initiated cancel; exit cleanly, do not treat as a failure
return;
}
throw e;
} Prevention
- Pass a fresh AbortController per embed call rather than reusing a shared one.
- Log cancellations at info/debug, not error, level.
- Do not share an abort signal across unrelated operations.
When it happens
Trigger: httpEmbedBatch (via httpEmbed or httpEmbedQuery) is called with requestOptions.signal, and that signal is aborted — either by the caller directly (controller.abort()), by a higher-level operation cancelling an analyze run, or by process shutdown. Also fires if the internal abortableSleep between retries is interrupted by abort.
Common situations: User cancels a long indexing run (Ctrl-C routed to abort). MCP server shuts down mid-query. A watchdog aborts a stalled embed. Test teardown aborts an in-flight request.
Related errors
- ${source} must be true/false or a non-negative integer (node
- ${source} must be a boolean or a non-negative integer (node
- ${name} must be a positive integer, got "${value}"
- embedding device must be one of auto, dml, cuda, cpu, wasm;
- initEmbedder() should not be called in HTTP mode. Use embedT
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/a7bcea11425cdb53.
Report an issue: GitHub.