{"record":{"id":"49e878948acd31fd","repo":"abhigyanpatwari/GitNexus","slug":"err-message-after-maxattempts-attempt-s-safeurl-url-batch","errorCode":null,"errorMessage":"${err.message} after ${maxAttempts} attempt(s) (${safeUrl(url)}, batch ${batchIndex})","messagePattern":"(.+?) after (.+?) attempt\\(s\\) \\((.+?), batch (.+?)\\)","errorType":"exception","errorClass":"HttpEmbeddingError","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/embeddings/http-client.ts","lineNumber":556,"sourceCode":"    );\n  } catch (err) {\n    if (\n      requestOptions.signal?.aborted ||\n      (err instanceof DOMException && err.name === 'AbortError')\n    ) {\n      throw new HttpEmbeddingError(\n        `Embedding request cancelled (${safeUrl(url)}, batch ${batchIndex})`,\n        { cause: err },\n      );\n    }\n    // Retries are exhausted on a bad 2xx body. Surface the message the sentinel\n    // carried, keeping the underlying parse error in `cause` only — the body\n    // text must never reach the `sanitizeReason` fallback and leak to stderr.\n    if (err instanceof RetryableEmbeddingBodyError) {\n      throw new HttpEmbeddingError(err.terminalMessage, { cause: err.cause });\n    }\n    if (err instanceof RetryableEmbeddingTimeoutError) {\n      throw new HttpEmbeddingError(\n        `${err.message} after ${maxAttempts} attempt(s) (${safeUrl(url)}, batch ${batchIndex})`,\n        { cause: err.cause },\n      );\n    }\n    if (err instanceof CircuitOpenError) {\n      throw new HttpEmbeddingError(\n        `Embedding endpoint circuit open (${safeUrl(url)}, batch ${batchIndex}): retry in ${Math.ceil(err.retryAfterMs / 1000)}s`,\n        { cause: err },\n      );\n    }\n    if (err instanceof DOMException && err.name === 'TimeoutError') {\n      throw new HttpEmbeddingError(\n        `Embedding request timed out after ${timeoutMs}ms (${safeUrl(url)}, batch ${batchIndex})`,\n        { cause: err },\n      );\n    }\n    if (err instanceof ResilientFetchExhaustedError) {\n      throw new HttpEmbeddingError(","sourceCodeStart":538,"sourceCodeEnd":574,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/ac9a4e9abd8fd3058c070b72c23402a4f887929a/gitnexus/src/core/embeddings/http-client.ts#L538-L574","documentation":"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.","triggerScenarios":"The embedding HTTP endpoint accepts the connection but does not respond within the per-attempt timeout, for all configured attempts, during httpEmbedBatch for batchIndex.","commonSituations":"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.","solutions":["Check the embedding server is up and responsive (health endpoint) and scale/restart it if overloaded.","Increase the client's per-request timeout to suit batch size and model latency.","Reduce batch size so each request completes well within the timeout.","Check network path latency to safeUrl; test with curl from the same host.","Verify the endpoint URL is correct — a wrong host that blackholes packets will always time out."],"exampleFix":"// before: tight timeout, big batches\nawait httpEmbedBatch(items, { timeoutMs: 2000, batchSize: 128 });\n// after: realistic timeout, smaller batches\nawait httpEmbedBatch(items, { timeoutMs: 30000, batchSize: 32 });","handlingStrategy":"retry","validationCode":"// cheap reachability probe before large batch runs\nconst ctrl = new AbortController();\nconst t = setTimeout(() => ctrl.abort(), 5000);\nconst probe = await fetch(healthUrl, { signal: ctrl.signal }).catch(() => null);\nclearTimeout(t);\nif (!probe || !probe.ok) throw new Error('embedding endpoint unreachable/slow');","typeGuard":null,"tryCatchPattern":"try {\n  vectors = await httpEmbedBatch(items, { timeoutMs: 30000 });\n} catch (e) {\n  if (e instanceof HttpEmbeddingError && /after \\d+ attempt/.test(e.message)) {\n    await backoff(1000);\n    vectors = await httpEmbedBatch(smaller(items), { timeoutMs: 60000 });\n  } else throw e;\n}","preventionTips":["Size timeouts to the slowest realistic batch, not the fastest.","Use small batches so each request finishes quickly.","Monitor embedding server latency and scale before timeouts start firing.","Verify network path (VPN/proxy) to the endpoint from the job's host."],"tags":["embeddings","http","timeout","retry-exhausted"],"backgroundTag":"request-timeout","analyzedSha":"ac9a4e9abd8fd3058c070b72c23402a4f887929a","analyzedAt":"2026-09-15T23:29:44.066Z","contentChangedAt":"2026-09-15T23:29:44.066Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}