abhigyanpatwari/GitNexus · error · GitNexusRcError
${source} entries must all be strings.
Error message
${source} entries must all be strings. What it means
Thrown by normalizeValue() in the 'string-array' case when the .gitnexusrc value is an array but one of its entries is not a string. fetchWrappers entries are interpolated into a downstream RegExp, so every entry must be a string before the identifier-shape regex is applied.
Source
Thrown at gitnexus/src/cli/analyze-config.ts:261
// fixed device token, so this guard never rejects a valid value there.
if (/[`*[\]<>]/.test(trimmed)) {
throw new GitNexusRcError(
`${source} must not contain Markdown-significant characters (\` * [ ] < >).`,
);
}
return trimmed;
}
case 'string-array': {
// Generic shared validator — `source` already names the config key, so
// messages here stay key-agnostic (no fetch-wrapper coupling in the
// shared normalizer; #1589/#1852 review F7).
if (!Array.isArray(value)) {
throw new GitNexusRcError(`${source} must be an array of strings.`);
}
const names: string[] = [];
for (const item of value) {
if (typeof item !== 'string') {
throw new GitNexusRcError(`${source} entries must all be strings.`);
}
const trimmed = item.trim();
if (!trimmed) {
throw new GitNexusRcError(`${source} entries must not be empty.`);
}
assertNoHiddenChars(trimmed, source);
// Values may be interpolated into a RegExp downstream. Restrict to
// identifier / member-access shapes so a config value can never smuggle
// regex metacharacters into a consumer.
if (!/^[A-Za-z_$][A-Za-z0-9_$.]*$/.test(trimmed)) {
throw new GitNexusRcError(
`${source} entry "${trimmed}" must be an identifier or member name ` +
`(letters, digits, _, $, . — e.g. "client.get").`,
);
}
names.push(trimmed);
}
if (names.length === 0) {View on GitHub (pinned to d540b00184)
Solutions
- Ensure every array entry is a string: "fetchWrappers": ["client.get", "api.fetch"].
- Remove any null/number/boolean entries from the array.
- Re-generate the config with consistent string typing.
Example fix
// before
{ "fetchWrappers": ["client.get", 42] }
// after
{ "fetchWrappers": ["client.get"] } Defensive patterns
Strategy: type-guard
Validate before calling
function assertAllStrings(arr: unknown[], key: string): void {
for (const item of arr) {
if (typeof item !== 'string') {
throw new Error(`${key} entries must all be strings, found ${typeof item}`);
}
}
} Type guard
function isArrayOfStrings(value: unknown): value is string[] {
return Array.isArray(value) && value.every((v) => typeof v === 'string');
} Prevention
- Keep array entries uniformly typed as strings.
- Remove null/number/boolean entries before committing.
- Re-generate config from a typed source rather than editing by hand.
When it happens
Trigger: Setting "fetchWrappers": ["client.get", 42], "fetchWrappers": [true], or "fetchWrappers": [null, "x"] in .gitnexusrc.
Common situations: A mixed-type array from a generated config; a number accidentally included where a function name was expected; a null placeholder left in the list.
Related errors
- ${source} must be a boolean (true/false).
- ${source} must be a string.
- ${source} must be an array of strings.
- ${source} must be a string branch name.
- ${GITNEXUS_RC_FILENAME} is not valid JSON: ${(err as Error).
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/3371c284c8b144ab.
Report an issue: GitHub.