{"record":{"id":"7aaee73a0bb7b6b6","repo":"abhigyanpatwari/GitNexus","slug":"source-must-be-a-string","errorCode":null,"errorMessage":"${source} must be a string.","messagePattern":"(.+?) must be a string\\.","errorType":"validation","errorClass":"GitNexusRcError","httpStatus":null,"severity":"error","filePath":"gitnexus/src/cli/analyze-config.ts","lineNumber":230,"sourceCode":"  switch (kind) {\n    case 'boolean':\n      if (typeof value !== 'boolean') {\n        throw new GitNexusRcError(`${source} must be a boolean (true/false).`);\n      }\n      return value;\n    case 'boolean-negate':\n      if (typeof value !== 'boolean') {\n        throw new GitNexusRcError(`${source} must be a boolean (true/false).`);\n      }\n      return !value;\n    case 'branch':\n      if (typeof value !== 'string') {\n        throw new GitNexusRcError(`${source} must be a string branch name.`);\n      }\n      return validateBranchName(value, source);\n    case 'string': {\n      if (typeof value !== 'string') {\n        throw new GitNexusRcError(`${source} must be a string.`);\n      }\n      const trimmed = value.trim();\n      if (!trimmed) {\n        throw new GitNexusRcError(`${source} must not be empty.`);\n      }\n      assertNoHiddenChars(trimmed, source);\n      // `name` flows into the generated AGENTS.md/CLAUDE.md as `**${name}**` and\n      // inside `gitnexus://repo/${name}/…` code spans, so a Markdown-significant\n      // character would break those spans or inject emphasis/links/HTML into\n      // agent-instruction content (#1996 tri-review P1). `_` is intentionally\n      // allowed (legitimate in repo names; intraword `_` is not emphasis).\n      // embeddingDevice (the other `string`-kind option) only ever holds a\n      // 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      }","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/cli/analyze-config.ts#L212-L248","documentation":"Thrown by normalizeValue() in the 'string' case (for keys like name, embeddingBaseUrl, embeddingModel, embeddingDevice) when the .gitnexusrc value is not a JSON string. After the type check the value is trimmed, checked for emptiness, hidden characters, and Markdown-significant characters in turn.","triggerScenarios":"Setting \"name\": 42, \"embeddingBaseUrl\": true, \"name\": null, or \"embeddingModel\": [\"x\"] in .gitnexusrc.","commonSituations":"A repo name set as a number; an embedding URL set as a boolean by mistake; a config generator that produced the wrong JSON type for a field.","solutions":["Quote the value: \"name\": \"my-repo\", \"embeddingBaseUrl\": \"http://localhost:11434\".","Omit the key if you do not need to override the default.","Check the value type with a JSON linter before committing."],"exampleFix":"// before\n{ \"name\": 42, \"embeddingBaseUrl\": true }\n\n// after\n{ \"name\": \"my-repo\", \"embeddingBaseUrl\": \"http://localhost:11434\" }","handlingStrategy":"type-guard","validationCode":"function assertConfigString(value: unknown, key: string): void {\n  if (typeof value !== 'string') {\n    throw new Error(`${key} must be a string, got ${typeof value}`);\n  }\n}","typeGuard":"function isConfigString(value: unknown): value is string {\n  return typeof value === 'string';\n}","tryCatchPattern":null,"preventionTips":["Quote all string config values in JSON, even when they look numeric (URLs, models).","Omit a key rather than setting it to null when you want the default.","Validate the file with a JSON schema or linter before committing."],"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"}