{"record":{"id":"b5a9eaca56197148","repo":"abhigyanpatwari/GitNexus","slug":"source-must-not-be-empty","errorCode":null,"errorMessage":"${source} must not be empty.","messagePattern":"(.+?) must not be empty\\.","errorType":"validation","errorClass":"GitNexusRcError","httpStatus":null,"severity":"warning","filePath":"gitnexus/src/cli/analyze-config.ts","lineNumber":224,"sourceCode":"      return validateBranchName(value, source);\n    case 'path': {\n      if (typeof value !== 'string') {\n        throw new GitNexusRcError(`${source} must be a file or directory path.`);\n      }\n      const trimmed = value.trim();\n      if (!trimmed) {\n        throw new GitNexusRcError(`${source} must not be empty.`);\n      }\n      assertNoHiddenChars(trimmed, source);\n      return trimmed;\n    }\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      }\n      return trimmed;\n    }\n    case 'string-array': {\n      // Generic shared validator — `source` already names the config key, so","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/ac9a4e9abd8fd3058c070b72c23402a4f887929a/gitnexus/src/cli/analyze-config.ts#L206-L242","documentation":"A tree-sitter grammar (or variant key like `typescript:tsx`) failed to load; the failure is logged once per key (deduped in `logged`) as `[gitnexus] <note> (<error.message>)`, with severity routing: 'error' goes to logger.error (required grammar) and otherwise logger.warn. Both go to stderr so MCP stdio framing is preserved; that language's parsing is simply unavailable for the session.","triggerScenarios":"loadGrammar(key) returns a failed LoadResult — the vendored grammar native module is missing or unloadable: no committed prebuild matched platform-arch and no C/C++ toolchain was present to source-build, an ABI mismatch after a Node/LadybugDB bump, or a corrupted node_modules install.","commonSituations":"Fresh installs on uncommon platforms (musl, ARM variants) where the optional-grammar prebuild is absent; upgrading Node major versions without reinstalling (NODE_MODULE_VERSION mismatch); optional grammars (dart/proto/swift/kotlin) skipped via GITNEXUS_SKIP_OPTIONAL_GRAMMARS=1 or missing toolchain (python3/make/g++).","solutions":["Reinstall dependencies so grammars rebuild/re-materialize: remove node_modules and reinstall","Install a C/C++ toolchain (python3, make, g++) if no prebuild matches your platform-arch","For optional languages only, silence by setting GITNEXUS_SKIP_OPTIONAL_GRAMMARS=1","Check result.note in the message — it distinguishes 'skipped optional' (warn) from 'required grammar failed' (error)"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"import { createRequire } from 'node:module';\nconst require = createRequire(import.meta.url);\n// preflight: can each required grammar's native module be loaded in this runtime?\nconst canLoadGrammar = ( moduleName: string): boolean => {\n  try { require.resolve(moduleName); return true; } catch { return false; }\n};\nfor (const g of ['tree-sitter', 'tree-sitter-typescript' /* , ... */]) {\n  if (!canLoadGrammar(g)) logger.warn(`grammar unavailable at plan time: ${g}`);\n}","typeGuard":"type LoadResult = { ok: boolean; severity?: 'error' | 'warn'; note: string; error: Error };\nconst isGrammarLoadFailure = (r: LoadResult): boolean => r.ok !== true;","tryCatchPattern":null,"preventionTips":["Reinstall node_modules after Node major-version upgrades (NODE_MODULE_VERSION ABI shifts)","Ensure a C/C++ toolchain (python3, make, g++) exists on platforms without committed prebuilds","Set GITNEXUS_SKIP_OPTIONAL_GRAMMARS=1 when optional languages are not needed"],"tags":["tree-sitter","grammar","native-module"],"backgroundTag":"native-module-load-failure","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"}