abhigyanpatwari/GitNexus · error · GitNexusRcError
${source} must be true/false or a non-negative integer (node
Error message
${source} must be true/false or a non-negative integer (node cap; 0 disables the cap). What it means
The `embeddings` config key was set to a JSON number that is not a non-negative integer — negative, fractional, NaN, or non-finite. This mirrors the `--embeddings [limit]` CLI flag: a boolean toggles embeddings, a non-negative integer sets the node cap (0 disables the cap).
Source
Thrown at gitnexus/src/cli/analyze-config.ts:312
}
return String(value);
}
if (typeof value === 'string') {
const trimmed = value.trim();
if (!trimmed) {
throw new GitNexusRcError(`${source} must not be empty.`);
}
return trimmed;
}
throw new GitNexusRcError(`${source} must be a number or numeric string.`);
}
case 'embeddings': {
// Mirror `--embeddings [limit]`: boolean toggles, a non-negative integer
// sets the node cap (normalized to a string, as Commander would supply).
if (typeof value === 'boolean') return value;
if (typeof value === 'number') {
if (!Number.isInteger(value) || value < 0) {
throw new GitNexusRcError(
`${source} must be true/false or a non-negative integer (node cap; 0 disables the cap).`,
);
}
return String(value);
}
throw new GitNexusRcError(
`${source} must be a boolean or a non-negative integer (node cap; 0 disables the cap).`,
);
}
default:
// Exhaustive — kept for forward-compat if a new kind is added.
throw new GitNexusRcError(`${source}: unsupported config value kind.`);
}
};
/**
* Normalize one level (flat top-level or the nested `analyze` block) into a
* partial `AnalyzeOptions`. Rejects unknown keys and two aliases that configureView on GitHub (pinned to d540b00184)
Solutions
- Use a boolean (true/false) to toggle embeddings on/off.
- Use a non-negative integer node cap; 0 disables the cap.
- Remove the key to accept the default behavior.
Example fix
// before "embeddings": 2.5 // after "embeddings": 100 — or — "embeddings": true
Defensive patterns
Strategy: validation
Validate before calling
const v = cfg.embeddings;
if (typeof v === 'number' && (!Number.isInteger(v) || v < 0)) {
throw new Error('embeddings must be a non-negative integer');
} Type guard
const isEmbeddingsNumber = (v) => typeof v === 'boolean' || (typeof v === 'number' && Number.isInteger(v) && v >= 0);
Prevention
- Remember 0 disables the cap — it is not an on/off toggle.
- Use a boolean for on/off, an integer for a node cap.
When it happens
Trigger: Setting { "embeddings": -1 }, { "embeddings": 2.5 }, or { "embeddings": 1.1 } in `.gitnexusrc`.
Common situations: Assuming 0/1 are on/off (they are not — 0 disables the cap, 1 caps at one node); passing a fractional limit; using a negative to mean 'disable' instead of false.
Related errors
- ${source} must be a boolean or a non-negative integer (node
- ${source} entry "${trimmed}" must be an identifier or member
- ${source} must list at least one string.
- ${source} must be a finite number.
- ${source} must be a number or numeric string.
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/d7df10555dfb5f01.
Report an issue: GitHub.