abhigyanpatwari/GitNexus · error · Error
Wiki was generated in
Error message
Wiki was generated in ${prevDisplay}; use --force to regenerate in ${nextDisplay}. What it means
WikiGenerator persists metadata (wikiDir/meta.json with fromCommit and lang) next to the generated wiki. On the up-to-date fast path (existing meta.fromCommit equals the current commit), it compares the requested output language (options.lang, '' meaning English default) against the language the wiki was generated in. When they differ it throws instead of silently returning 'up-to-date', because the existing pages are in the wrong language and only a full regeneration can switch it.
Solutions
- Rerun with --force to regenerate all pages in the new language: `gitnexus wiki --force --lang <lang>`
- Or drop/change the --lang flag so it matches the language the existing wiki was generated in (message names both, e.g. 'japanese' vs 'english (default)')
- Or delete the wiki output directory (containing meta.json) to discard the old-language wiki and rerun without --force
Example fix
# before gitnexus wiki --lang japanese # wiki was generated in english # after gitnexus wiki --lang japanese --force
Defensive patterns
Strategy: try-catch
Validate before calling
// Before calling generate(), compare persisted language with the requested one:
import fs from 'fs/promises';
const meta = await fs.readFile(`${wikiDir}/meta.json`, 'utf8')
.then(JSON.parse).catch(() => null);
const currentLang = normalizeLang(options.lang ?? ''); // '' = english default
if (meta?.fromCommit === currentCommit && (meta.lang ?? '') !== currentLang) {
options = { ...options, force: true }; // pre-empt the guard
} Try / catch
try {
const result = await generator.generate();
} catch (err) {
if (err instanceof Error && err.message.startsWith('Wiki was generated in ')) {
// Re-run with force: full regeneration in the new language
return generatorWithForce.generate();
}
throw err;
} Prevention
- Keep --lang consistent between wiki runs, or script it to always pass --force when the language changes
- In CI, decide once whether wikis are translated and pin that --lang value
- Read wikiDir/meta.json (fields fromCommit/lang) before running to detect a pending language switch
When it happens
Trigger: Running `gitnexus wiki` (WikiGenerator.generate()) without --force when a wiki already exists for the current HEAD commit and meta.lang differs from the effective --lang value, e.g. wiki generated with `--lang japanese` then rerun with `--lang german` or with no --lang after a non-English run.
Common situations: Switching wiki language on a repo whose wiki is already up to date; a teammate generated the wiki with a different --lang default; CI re-running the wiki command with a lang option that differs from the cached artifact; reverting from a translated wiki back to English.
Related errors
- No source files found in the knowledge graph. Nothing to…
- --allow-insecure-connection /…
- Analyzer build scan exceeded depth
- Analyzer build scan exceeded
- Analyzer build scan exceeded
AI-assisted analysis of abhigyanpatwari/GitNexus@52924ef12c (2026-08-20).
Data as JSON: /api/errors/da9c0dfaad4408d3.
Report an issue: GitHub.
Appendix: source
Thrown at gitnexus/src/core/wiki/generator.ts:276
/**
* Main entry point. Runs the full pipeline or incremental update.
*/
async run(): Promise<WikiRunResult> {
await fs.mkdir(this.wikiDir, { recursive: true });
const existingMeta = await this.loadWikiMeta();
const currentCommit = this.getCurrentCommit();
const forceMode = this.options.force;
// Up-to-date check (skip if --force)
if (!forceMode && existingMeta && existingMeta.fromCommit === currentCommit) {
const currentLang = this.effectiveLang();
const metaLang = existingMeta.lang ?? '';
if (currentLang !== metaLang) {
const prevDisplay = metaLang || 'english (default)';
const nextDisplay = currentLang || 'english (default)';
throw new Error(
`Wiki was generated in ${prevDisplay}; use --force to regenerate in ${nextDisplay}.`,
);
}
// Still regenerate the HTML viewer in case it's missing
await this.ensureHTMLViewer();
return { pagesGenerated: 0, mode: 'up-to-date', failedModules: [] };
}
// Force mode: delete snapshot to force full re-grouping
if (forceMode) {
try {
await fs.unlink(path.join(this.wikiDir, 'first_module_tree.json'));
} catch {}
// Delete existing module pages so they get regenerated
const existingFiles = await fs.readdir(this.wikiDir).catch(() => [] as string[]);
for (const f of existingFiles) {
if (f.endsWith('.md')) {
try {View on GitHub (pinned to 52924ef12c)