abhigyanpatwari/GitNexus · error · GitNexusRcError
${source} entry "${trimmed}" must be an identifier or member
Error message
${source} entry "${trimmed}" must be an identifier or member name (letters, digits, _, $, . — e.g. "client.get"). What it means
A `.gitnexusrc` key declared as a string-array (currently only `fetchWrappers`) received an entry that is not a valid identifier or dotted member name. GitNexus restricts these entries to the regex /^[A-Za-z_$][A-Za-z0-9_$.]*$/ because the values are interpolated into a RegExp used by the cross-file HTTP-consumer scan, so a free-form string could smuggle regex metacharacters and alter the scan. The `source` placeholder expands to the config key context, e.g. `.gitnexusrc "fetchWrappers"`.
Source
Thrown at gitnexus/src/cli/analyze-config.ts:272
// 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) {
throw new GitNexusRcError(`${source} must list at least one string.`);
}
// De-duplicate and cap to a sane bound so a pathological config cannot
// blow up the consumer scan's alternation.
return Array.from(new Set(names)).slice(0, 100);
}
case 'numeric-string': {
// Mirror Commander's contract: these options reach the existing CLI
// validation as strings. Accept a JSON number or a string; normalize to a
// string and let the downstream per-flag validation enforce ranges so the
// error messages stay in one place.View on GitHub (pinned to d540b00184)
Solutions
- Use a bare identifier or dotted member-access path matching /^[A-Za-z_$][A-Za-z0-9_$.]*$/, e.g. `client.get` or `apiFetch`.
- Strip any parentheses, spaces, dashes, slashes, or regex metacharacters from the entry.
- Point at the wrapper function's declared name in source, not its call site.
Example fix
// before "fetchWrappers": ["api.fetch()"] // after "fetchWrappers": ["api.fetch"]
Defensive patterns
Strategy: validation
Validate before calling
// Validate every string-array entry before committing .gitnexusrc
const IDENT_OR_MEMBER = /^[A-Za-z_$][A-Za-z0-9_$.]*$/;
function validateFetchWrappers(arr) {
if (!Array.isArray(arr)) throw new Error('fetchWrappers must be an array');
return arr.map((v) => {
if (typeof v !== 'string') throw new Error('entry must be a string: ' + v);
const t = v.trim();
if (!t || !IDENT_OR_MEMBER.test(t)) {
throw new Error('entry "' + v + '" must be an identifier or member name');
}
return t;
});
} Type guard
const isFetchWrapperName = (v) => typeof v === 'string' && /^[A-Za-z_$][A-Za-z0-9_$.]*$/.test(v.trim()) && v.trim().length > 0;
Prevention
- Keep fetchWrappers entries as bare dotted identifiers — no parentheses, dashes, slashes, or spaces.
- Lint .gitnexusrc in a pre-commit hook with the same regex the normalizer uses.
When it happens
Trigger: Setting { "fetchWrappers": ["api.fetch("] } — the trailing `(` fails the identifier regex. Also `my-wrapper` (dash), `fetch ()` (space/parens), or `lib/http.get` (slash).
Common situations: Adding a custom axios/fetch wrapper and copying the call syntax (with parentheses) instead of the function name; using kebab-case or path separators for a wrapper declared elsewhere; attempting to pass a method signature.
Related errors
- ${source} must list at least one string.
- ${source} must be a finite number.
- ${source} must be a number or numeric string.
- ${source} must be true/false or a non-negative integer (node
- ${source} must be a boolean or a non-negative integer (node
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/87122d308fab7816.
Report an issue: GitHub.