abhigyanpatwari/GitNexus · error · Error
GITNEXUS_EMBEDDING_REQUEST_DIMS must be a positive integer…
Error message
GITNEXUS_EMBEDDING_REQUEST_DIMS must be a positive integer, got "${rawRequestDims}" What it means
readConfig() validates GITNEXUS_EMBEDDING_REQUEST_DIMS — the dimensions parameter sent in each request body (for endpoints supporting Matryoshka truncation). It is optional: the sentinel values omit/none/off/false/0 (case-insensitive) suppress the parameter; anything else must be pure digits. Non-digit values throw with EMBEDDING_REQUEST_DIMS_ENV_ERROR_LEAD.
Solutions
- Use a plain integer (GITNEXUS_EMBEDDING_REQUEST_DIMS=256) or one of the omit sentinels (omit/none/off/false/0).
- Unset the variable to inherit GITNEXUS_EMBEDDING_DIMS.
- Keep the declared dims and request dims consistent to avoid vector-length mismatches at the DB layer.
Example fix
# before export GITNEXUS_EMBEDDING_REQUEST_DIMS='none-needed' # after export GITNEXUS_EMBEDDING_REQUEST_DIMS=none # or unset it
Defensive patterns
Strategy: validation
Validate before calling
const rd = process.env.GITNEXUS_EMBEDDING_REQUEST_DIMS?.trim();
if (rd && !/^(omit|none|off|false|0)$/i.test(rd) && !/^\d+$/.test(rd)) {
throw new Error('GITNEXUS_EMBEDDING_REQUEST_DIMS must be an integer or an omit sentinel');
} Type guard
const isRequestDimsEnvError = (e: unknown): boolean =>
e instanceof Error && e.message.includes('GITNEXUS_EMBEDDING_REQUEST_DIMS must be'); Try / catch
try {
await httpEmbed(texts);
} catch (e) {
if (isRequestDimsEnvError(e)) { /* fix/unset REQUEST_DIMS; non-retryable */ }
else throw e;
} Prevention
- Use omit/none/off/false/0 exactly to suppress the request dims — they are case-insensitive but exact-match.
- Keep GITNEXUS_EMBEDDING_DIMS (declared) and REQUEST_DIMS (per-request truncation) roles straight.
When it happens
Trigger: GITNEXUS_EMBEDDING_REQUEST_DIMS='half', '768.0', '-1', or 'true' (note: bare '0' is a legal alias for omit and does NOT throw) while HTTP embedding mode is configured.
Common situations: Confusing this knob with GITNEXUS_EMBEDDING_DIMS (declared dims) and setting a non-numeric sentinel the parser doesn't know; copy-paste from provider docs describing truncation ratios.
Related errors
- GITNEXUS_EMBEDDING_DIMS must be a positive integer, got
- must be a positive integer, got
- Embedding endpoint returned an unexpected response shape
- must be a non-negative integer, got
- must be a positive integer <= , got
AI-assisted analysis of abhigyanpatwari/GitNexus@ac9a4e9abd (2026-08-20).
Data as JSON: /api/errors/01cc46bd2d59124d.
Report an issue: GitHub.
Appendix: source
Thrown at gitnexus/src/core/embeddings/http-client.ts:176
if (rawDims !== undefined) {
if (!/^\d+$/.test(rawDims)) {
throw new Error(`${EMBEDDING_DIMS_ENV_ERROR_LEAD}, got "${rawDims}"`);
}
const parsed = parseInt(rawDims, 10);
if (parsed <= 0) {
throw new Error(`${EMBEDDING_DIMS_ENV_ERROR_LEAD}, got "${rawDims}"`);
}
dimensions = parsed;
}
const rawRequestDims = process.env.GITNEXUS_EMBEDDING_REQUEST_DIMS?.trim();
let requestDimensions = dimensions;
if (rawRequestDims) {
if (/^(omit|none|off|false|0)$/i.test(rawRequestDims)) {
requestDimensions = undefined;
} else {
if (!/^\d+$/.test(rawRequestDims)) {
throw new Error(`${EMBEDDING_REQUEST_DIMS_ENV_ERROR_LEAD}, got "${rawRequestDims}"`);
}
const parsed = parseInt(rawRequestDims, 10);
if (parsed <= 0) {
throw new Error(`${EMBEDDING_REQUEST_DIMS_ENV_ERROR_LEAD}, got "${rawRequestDims}"`);
}
requestDimensions = parsed;
}
}
return {
baseUrl: baseUrl.replace(/\/+$/, ''),
model,
apiKey: process.env.GITNEXUS_EMBEDDING_API_KEY ?? 'unused',
dimensions,
maxAttempts: parsePositiveIntegerEnv(
'GITNEXUS_EMBEDDING_MAX_ATTEMPTS',
HTTP_MAX_RETRIES + 1,
20,View on GitHub (pinned to ac9a4e9abd)