{"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":261,"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":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/cli/analyze-config.ts#L243-L279","documentation":"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.","triggerScenarios":"Setting \"fetchWrappers\": [\"client.get\", 42], \"fetchWrappers\": [true], or \"fetchWrappers\": [null, \"x\"] in .gitnexusrc.","commonSituations":"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.","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."],"exampleFix":"// before\n{ \"fetchWrappers\": [\"client.get\", 42] }\n\n// after\n{ \"fetchWrappers\": [\"client.get\"] }","handlingStrategy":"type-guard","validationCode":"function assertAllStrings(arr: unknown[], key: string): void {\n  for (const item of arr) {\n    if (typeof item !== 'string') {\n      throw new Error(`${key} entries must all be strings, found ${typeof item}`);\n    }\n  }\n}","typeGuard":"function isArrayOfStrings(value: unknown): value is string[] {\n  return Array.isArray(value) && value.every((v) => typeof v === 'string');\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["validation","config","typescript","json"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}