{"record":{"id":"3371c284c8b144ab","repo":"abhigyanpatwari/GitNexus","slug":"source-entries-must-all-be-strings","errorCode":null,"errorMessage":"${source} entries must all be strings.","messagePattern":"(.+?) entries must all be strings\\.","errorType":"validation","errorClass":"GitNexusRcError","httpStatus":null,"severity":"error","filePath":"gitnexus/src/cli/analyze-config.ts","lineNumber":251,"sourceCode":"      // fixed device token, so this guard never rejects a valid value there.\n      if (/[`*[\\]<>]/.test(trimmed)) {\n        throw new GitNexusRcError(\n          `${source} must not contain Markdown-significant characters (\\` * [ ] < >).`,\n        );\n      }\n      return trimmed;\n    }\n    case 'string-array': {\n      // Generic shared validator — `source` already names the config key, so\n      // messages here stay key-agnostic (no fetch-wrapper coupling in the\n      // shared normalizer; #1589/#1852 review F7).\n      if (!Array.isArray(value)) {\n        throw new GitNexusRcError(`${source} must be an array of strings.`);\n      }\n      const names: string[] = [];\n      for (const item of value) {\n        if (typeof item !== 'string') {\n          throw new GitNexusRcError(`${source} entries must all be strings.`);\n        }\n        const trimmed = item.trim();\n        if (!trimmed) {\n          throw new GitNexusRcError(`${source} entries must not be empty.`);\n        }\n        assertNoHiddenChars(trimmed, source);\n        // Values may be interpolated into a RegExp downstream. Restrict to\n        // identifier / member-access shapes so a config value can never smuggle\n        // regex metacharacters into a consumer.\n        if (!/^[A-Za-z_$][A-Za-z0-9_$.]*$/.test(trimmed)) {\n          throw new GitNexusRcError(\n            `${source} entry \"${trimmed}\" must be an identifier or member name ` +\n              `(letters, digits, _, $, . — e.g. \"client.get\").`,\n          );\n        }\n        names.push(trimmed);\n      }\n      if (names.length === 0) {","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/ac9a4e9abd8fd3058c070b72c23402a4f887929a/gitnexus/src/cli/analyze-config.ts#L233-L269","documentation":"Thrown while loading .gitnexusrc: the string-array validator (used by the 'fetchWrappers' key) found an array element that is not a string. GitNexus normalizes every rc value through per-kind validators before merging it into analyze options, so a heterogeneous array aborts startup with a GitNexusRcError naming the offending key.","triggerScenarios":"A .gitnexusrc containing e.g. {\"fetchWrappers\": [\"client.get\", 42]} or [null], or the same under a nested \"analyze\" block; loadAnalyzeConfig(repoRoot) then throws before any indexing starts.","commonSituations":"Hand-editing .gitnexusrc and mixing types (a number instead of a quoted string), or generating the file from a script/CI template that serializes numbers unquoted; also pasting YAML-style lists into what must be strict JSON.","solutions":["Quote every element of fetchWrappers so the array is string-only: {\"fetchWrappers\": [\"client.get\", \"fetch\"]}","Re-run node .gitnexus/run.cjs analyze (or your usual gitnexus command) to confirm the rc file now loads","Validate .gitnexusrc with a JSON linter or jsonschema check in CI before it reaches the CLI"],"exampleFix":"// before (.gitnexusrc)\n{\"fetchWrappers\": [\"client.get\", 42]}\n// after\n{\"fetchWrappers\": [\"client.get\"]}","handlingStrategy":"validation","validationCode":"// Before running analyze, validate .gitnexusrc yourself:\nimport { readFileSync } from 'node:fs';\nconst rc = JSON.parse(readFileSync('.gitnexusrc', 'utf8'));\nconst fw = rc.fetchWrappers ?? rc.analyze?.fetchWrappers;\nif (fw !== undefined && !(Array.isArray(fw) && fw.every((x) => typeof x === 'string'))) {\n  throw new Error('fetchWrappers must be an array of strings');\n}","typeGuard":"const isStringArray = (v: unknown): v is string[] =>\n  Array.isArray(v) && v.every((x) => typeof x === 'string');","tryCatchPattern":"try {\n  loadAnalyzeConfig(repoRoot);\n} catch (err) {\n  if (err instanceof GitNexusRcError) {\n    console.error(`Bad .gitnexusrc: ${err.message}`); // message names the key\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Lint .gitnexusrc in CI with a JSON schema that types fetchWrappers as string[]","Never generate the rc file by string-concatenation; serialize a typed object","Quote every array element when hand-editing"],"tags":["config","validation","json","gitnexusrc"],"backgroundTag":"config-type-mismatch","analyzedSha":"ac9a4e9abd8fd3058c070b72c23402a4f887929a","analyzedAt":"2026-08-20T23:29:22.980Z","contentChangedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}