abhigyanpatwari/GitNexus · info · Error
Wiki was generated in ${prevDisplay}; use --force to regener
Error message
Wiki was generated in ${prevDisplay}; use --force to regenerate in ${nextDisplay}. What it means
Thrown during wiki generation's up-to-date check (first site, before DB initialization) when the wiki was already generated for the current commit but in a different language than the effective language of this run. The check is skipped when `--force` is set. This prevents silently overwriting a wiki generated in one language with content in another without explicit consent.
Source
Thrown at gitnexus/src/core/wiki/generator.ts:268
/**
* 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 d540b00184)
Solutions
- Add `--force` to regenerate the wiki in the new language: `gitnexus wiki --force`.
- Or switch back to the language the wiki was generated in (shown in the error as `prevDisplay`).
Example fix
# before gitnexus wiki --lang japanese # error: Wiki was generated in english (default); use --force to regenerate in japanese. # after gitnexus wiki --lang japanese --force
Defensive patterns
Strategy: validation
Validate before calling
// Before wiki generation, check if a language change is needed:
const meta = await loadWikiMeta();
if (meta && meta.fromCommit === currentCommit && meta.lang !== desiredLang) {
console.log(`Wiki exists in ${meta.lang}. Pass --force to regenerate in ${desiredLang}.`);
// either add --force or abort
} Type guard
const needsForceForLanguageChange = ( meta: WikiMeta | undefined, currentCommit: string, desiredLang: string, ): boolean => !!meta && meta.fromCommit === currentCommit && (meta.lang ?? '') !== (desiredLang ?? '');
Try / catch
try {
await generator.generate();
} catch (err) {
if (err instanceof Error && err.message.startsWith('Wiki was generated in')) {
console.error('Add --force to regenerate in the new language.');
}
throw err;
} Prevention
- Always pass `--force` when intentionally changing the wiki language on the same commit.
- Pin the wiki language in `.gitnexusrc` to avoid accidental language mismatches.
When it happens
Trigger: `!forceMode && existingMeta && existingMeta.fromCommit === currentCommit` and `this.effectiveLang() !== existingMeta.lang`. The existing wiki metadata records a different language than the current run's resolved language (which defaults to English or respects a `--lang` flag).
Common situations: Generated a wiki in English, then ran `gitnexus wiki --lang japanese` on the same commit without `--force`; or the `GITNEXUS_WIKI_LANG` env var changed between runs on an unchanged repo.
Related errors
- OpenAI API key is required but was not provided
- OpenRouter API key is required but was not provided
- MiniMax API key is required but was not provided
- GLM API key is required but was not provided
- DeepSeek API key is required but was not provided
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/da9c0dfaad4408d3.
Report an issue: GitHub.