abhigyanpatwari/GitNexus · error · WatchControlReloadError
Ignore controls remain invalid; fix them before indexing mor
Error message
Ignore controls remain invalid; fix them before indexing more changes.
What it means
Wrapped in WatchControlReloadError by startWatchFileLoop in watch.ts when the watch ignore predicate (ignore-file/ignore-pattern controls) fails to reload and the loop is in its retrying pass — i.e. the ignore controls were already invalid once, the watcher retried, and they are still broken. Indexing more changes with broken ignore controls is refused to avoid indexing files the user meant to exclude.
Source
Thrown at gitnexus/src/cli/watch.ts:264
repoPath: string,
debounceMs: number,
refresh: (paths: readonly string[]) => Promise<void>,
onError: WatchRefreshError,
onWatcherError: (error: unknown) => void = (error) => onError(error, []),
): Promise<WatchFileLoop> {
let ignorePath = await createWatchIgnorePredicate(repoPath);
let ignoreControlValid = true;
const queue = new WatchRefreshQueue(
async (paths) => {
if (paths.some(isIgnoreControlPath) || !ignoreControlValid) {
const retryingInvalidControls = !ignoreControlValid;
try {
ignorePath = await createWatchIgnorePredicate(repoPath);
ignoreControlValid = true;
watcher.add(repoPath);
} catch (error) {
ignoreControlValid = false;
throw new WatchControlReloadError(
retryingInvalidControls
? new Error(
'Ignore controls remain invalid; fix them before indexing more changes.',
{
cause: error,
},
)
: error,
);
}
}
await refresh(paths);
},
onError,
debounceMs,
{
maxWaitMs: Math.max(2_000, debounceMs * 10),
maxPendingPaths: 1_000,View on GitHub (pinned to 52924ef12c)
Solutions
- Fix the ignore control file: repair or remove the invalid pattern(s) that broke createWatchIgnorePredicate.
- Restore the ignore file if it was deleted or moved (restore permissions: readable by the watch process).
- Validate patterns with git check-ignore or a glob tester before saving while the watcher is running.
- Restart `analyze --watch` after fixing; the loop only recovers once the controls parse successfully.
Example fix
// before (.gitnexusignore while watcher runs) **/[invalid // after **/dist/ **/*.log
Defensive patterns
Strategy: try-catch
Validate before calling
import ignore from 'ignore';
export function validateIgnoreControls(repoRoot: string): void {
const ig = ignore();
ig.add(fs.readFileSync(path.join(repoRoot, '.gitnexusignore'), 'utf8')); // throws on bad patterns
} Try / catch
watchLoop.on('error', (e) => {
if (e instanceof WatchControlReloadError && /Ignore controls remain invalid/.test(e.message)) {
console.error('Fix ignore patterns (see cause), then restart watch:', e.cause);
process.exitCode = 1;
} else throw e;
}); Prevention
- Test new ignore globs (git check-ignore or a glob tester) before saving while the watcher runs.
- Never delete or chmod the ignore file during an active watch session.
- Keep ignore patterns simple and anchored to avoid parser edge cases.
When it happens
Trigger: createWatchIgnorePredicate(repoPath) throws on the retry after a previous failure — typically because the ignore file is malformed, unreadable, was deleted, or contains invalid patterns, and the error surfaces during watch-loop rearming.
Common situations: Editing .gitignore / the gitnexus ignore control file while `analyze --watch` runs and saving a syntax error; deleting or chmod-ing the ignore file; a pattern the parser rejects (e.g. bad glob).
Related errors
- Configuration remains invalid; fix it before indexing more c
- Ignore controls remain invalid; fix them before indexing mor
- ${flag} must be a positive integer
- ${flag} must not exceed ${maximum}
- analyze --watch does not support ${unsupported.map(([name])
AI-assisted analysis of abhigyanpatwari/GitNexus@52924ef12c (2026-09-01).
Data as JSON: /api/errors/85722ca8c5f20dd1.
Report an issue: GitHub.