{"record":{"id":"3812d608706d2b43","repo":"neoclide/coc.nvim","slug":"unable-to-watch","errorCode":null,"errorMessage":"unable to watch","messagePattern":"unable to watch","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/watchman.ts","lineNumber":162,"sourceCode":"      this.client.end()\n      this.client = undefined\n    }\n  }\n\n  private appendOutput(message: string, type = \"Info\"): void {\n    if (this.channel) {\n      this.channel.appendLine(`[${type}  - ${(new Date().toLocaleTimeString())}] ${message}`)\n    }\n  }\n\n  public static async createClient(binaryPath: string, root: string, channel?: OutputChannel): Promise<Watchman> {\n    let watchman: Watchman\n    try {\n      watchman = new Watchman(binaryPath, channel)\n      let valid = await watchman.checkCapability()\n      if (!valid) throw new Error('required capabilities do not exist.')\n      let watching = await watchman.watchProject(root)\n      if (!watching) throw new Error('unable to watch')\n      return watchman\n    } catch (e) {\n      if (watchman) watchman.dispose()\n      throw e\n    }\n  }\n}\n","sourceCodeStart":144,"sourceCodeEnd":170,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/core/watchman.ts#L144-L170","documentation":"After capability checks pass, Watchman.createClient calls watchProject(root); if watchman cannot establish a watch on the given root (watchProject returns falsy), it throws 'unable to watch'. The partially constructed client is disposed before rethrowing.","triggerScenarios":"Watchman.createClient(binaryPath, root) where watchman.watchProject(root) resolves false — typically because root does not exist, is not readable, is excluded by watchman config (.watchmanconfig ignore), or watchman refuses the path.","commonSituations":"Passing a deleted or symlinked-but-broken directory as root; project on a network mount watchman cannot watch; watchman's ignore list excludes the folder; permissions issues on the directory.","solutions":["Verify the root path exists and is a readable directory before calling createClient.","Check .watchmanconfig and watchman's ignore rules for exclusions of the path.","Run 'watchman watch-project <root>' manually to see the underlying watchman error.","Ensure the directory is on a local filesystem watchman supports (not a network mount)."],"exampleFix":"// before\nlet wm = await Watchman.createClient(watchmanPath, '/mnt/network/project') // 'unable to watch'\n// after\nif (fs.existsSync('/home/user/project')) {\n  let wm = await Watchman.createClient(watchmanPath, '/home/user/project')\n}","handlingStrategy":"validation","validationCode":"const fs = require('fs')\nif (!fs.existsSync(root) || !fs.statSync(root).isDirectory()) {\n  throw new Error(`Cannot watch non-directory root: ${root}`)\n}","typeGuard":null,"tryCatchPattern":"try {\n  const wm = await Watchman.createClient(binaryPath, root)\n} catch (e) {\n  if (e.message === 'unable to watch') {\n    logger.warn(`watchman cannot watch ${root}; falling back to fs watcher`)\n    return fallbackWatcher(root)\n  } else throw e\n}","preventionTips":["Ensure the root exists and is a readable local directory before calling createClient.","Keep network mounts and excluded paths out of watchman roots.","Test manually with 'watchman watch-project <root>' to surface ignore/permission issues early."],"tags":["watchman","file-watcher","filesystem"],"backgroundTag":"watch-registration-failed","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}