{"record":{"id":"bb0192827509a36b","repo":"abhigyanpatwari/GitNexus","slug":"no-source-files-found-in-the-knowledge-graph-noth","errorCode":null,"errorMessage":"No source files found in the knowledge graph. Nothing to document.","messagePattern":"No source files found in the knowledge graph\\. Nothing to document\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/wiki/generator.ts","lineNumber":351,"sourceCode":"    this.onProgress('html', 98, 'Building HTML viewer...');\n    const repoName = path.basename(this.repoPath);\n    await generateHTMLViewer(this.wikiDir, repoName);\n  }\n\n  // ─── Full Generation ────────────────────────────────────────────────\n\n  private async fullGeneration(currentCommit: string): Promise<WikiRunResult> {\n    let pagesGenerated = 0;\n\n    // Phase 0: Gather structure\n    this.onProgress('gather', 5, 'Querying graph for file structure...');\n    const filesWithExports = await getFilesWithExports();\n    const allFiles = await getAllFiles();\n\n    // Filter to source files only\n    const sourceFiles = allFiles.filter((f) => !shouldIgnorePath(f));\n    if (sourceFiles.length === 0) {\n      throw new Error('No source files found in the knowledge graph. Nothing to document.');\n    }\n\n    // Build enriched file list (merge exports into all source files)\n    const exportMap = new Map(filesWithExports.map((f) => [f.filePath, f]));\n    const enrichedFiles: FileWithExports[] = sourceFiles.map((fp) => {\n      return exportMap.get(fp) || { filePath: fp, symbols: [] };\n    });\n\n    this.onProgress('gather', 10, `Found ${sourceFiles.length} source files`);\n\n    // Phase 1: Build module tree\n    const moduleTree = await this.buildModuleTree(enrichedFiles);\n    pagesGenerated = 0;\n\n    // If reviewOnly mode, save tree and stop for user to review/edit\n    if (this.options.reviewOnly) {\n      await this.saveModuleTree(moduleTree);\n      this.onProgress('review', 30, 'Module tree ready for review');","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/wiki/generator.ts#L333-L369","documentation":"Thrown at the start of `fullGeneration` when, after querying the knowledge graph for all files and filtering out ignored paths, zero source files remain. The wiki generator has nothing to document — no file exports, no module tree, no symbol pages. This indicates the graph is empty, contains only non-source files, or all files were filtered by `shouldIgnorePath`.","triggerScenarios":"`getAllFiles()` returns files, but `allFiles.filter((f) => !shouldIgnorePath(f))` results in an empty array. Or `getAllFiles()` itself returns an empty array because the graph was never populated or was corrupted.","commonSituations":"Running `gitnexus wiki` on a repository that was never analyzed (empty graph); analyzing a repo where all files are in ignored directories (e.g., everything under `node_modules` or `vendor/`); a corrupt or partially-written graph where the files table is empty; analyzing a non-code repository (documentation-only, binary-only).","solutions":["Run `gitnexus analyze` first to populate the knowledge graph, then retry `gitnexus wiki`.","Run `gitnexus status` to verify the graph has symbols and files indexed.","If the graph appears populated but all files are filtered, check `.gitnexusignore` or the `shouldIgnorePath` rules — your source directories may be excluded.","If the graph is corrupt, run `gitnexus analyze --force` for a full rebuild."],"exampleFix":"# before\ngitnexus wiki\n# error: No source files found in the knowledge graph. Nothing to document.\n# after\ngitnexus analyze    # populate the graph first\ngitnexus status     # verify files are indexed\ngitnexus wiki       # now has source files to document","handlingStrategy":"validation","validationCode":"// Before wiki generation, verify the graph has source files:\nconst allFiles = await getAllFiles();\nconst sourceFiles = allFiles.filter((f) => !shouldIgnorePath(f));\nif (sourceFiles.length === 0) {\n  console.error('No source files in the graph. Run `gitnexus analyze` first.');\n  process.exit(1);\n}","typeGuard":"const hasSourceFilesInGraph = async (): Promise<boolean> => {\n  const files = await getAllFiles();\n  return files.some((f) => !shouldIgnorePath(f));\n};","tryCatchPattern":"try {\n  await generator.generate();\n} catch (err) {\n  if (err instanceof Error && err.message.includes('No source files found in the knowledge graph')) {\n    console.error('Run `gitnexus analyze` to populate the graph, then retry `gitnexus wiki`.');\n  }\n  throw err;\n}","preventionTips":["Always run `gitnexus analyze` before `gitnexus wiki` — the wiki depends on a populated graph.","Run `gitnexus status` to verify file/symbol counts before wiki generation.","Check `.gitnexusignore` rules if legitimate source files are being filtered out."],"tags":["wiki","knowledge-graph","empty-state","analyze"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}