{"record":{"id":"85722ca8c5f20dd1","repo":"abhigyanpatwari/GitNexus","slug":"ignore-controls-remain-invalid-fix-them-before-in","errorCode":null,"errorMessage":"Ignore controls remain invalid; fix them before indexing more changes.","messagePattern":"Ignore controls remain invalid; fix them before indexing more changes\\.","errorType":"exception","errorClass":"WatchControlReloadError","httpStatus":null,"severity":"error","filePath":"gitnexus/src/cli/watch.ts","lineNumber":264,"sourceCode":"  repoPath: string,\n  debounceMs: number,\n  refresh: (paths: readonly string[]) => Promise<void>,\n  onError: WatchRefreshError,\n  onWatcherError: (error: unknown) => void = (error) => onError(error, []),\n): Promise<WatchFileLoop> {\n  let ignorePath = await createWatchIgnorePredicate(repoPath);\n  let ignoreControlValid = true;\n  const queue = new WatchRefreshQueue(\n    async (paths) => {\n      if (paths.some(isIgnoreControlPath) || !ignoreControlValid) {\n        const retryingInvalidControls = !ignoreControlValid;\n        try {\n          ignorePath = await createWatchIgnorePredicate(repoPath);\n          ignoreControlValid = true;\n          watcher.add(repoPath);\n        } catch (error) {\n          ignoreControlValid = false;\n          throw new WatchControlReloadError(\n            retryingInvalidControls\n              ? new Error(\n                  'Ignore controls remain invalid; fix them before indexing more changes.',\n                  {\n                    cause: error,\n                  },\n                )\n              : error,\n          );\n        }\n      }\n      await refresh(paths);\n    },\n    onError,\n    debounceMs,\n    {\n      maxWaitMs: Math.max(2_000, debounceMs * 10),\n      maxPendingPaths: 1_000,","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/52924ef12c2290ceee4612526a828ec4cdf2047f/gitnexus/src/cli/watch.ts#L246-L282","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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."],"exampleFix":"// before (.gitnexusignore while watcher runs)\n**/[invalid\n\n// after\n**/dist/\n**/*.log","handlingStrategy":"try-catch","validationCode":"import ignore from 'ignore';\nexport function validateIgnoreControls(repoRoot: string): void {\n  const ig = ignore();\n  ig.add(fs.readFileSync(path.join(repoRoot, '.gitnexusignore'), 'utf8')); // throws on bad patterns\n}","typeGuard":null,"tryCatchPattern":"watchLoop.on('error', (e) => {\n  if (e instanceof WatchControlReloadError && /Ignore controls remain invalid/.test(e.message)) {\n    console.error('Fix ignore patterns (see cause), then restart watch:', e.cause);\n    process.exitCode = 1;\n  } else throw e;\n});","preventionTips":["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."],"tags":["watch-mode","ignore-rules","config-invalid","file-watcher"],"backgroundTag":"invalid-ignore-pattern","analyzedSha":"52924ef12c2290ceee4612526a828ec4cdf2047f","analyzedAt":"2026-09-01T13:15:02.810Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}