dmtrKovalenko/fff · error · Error

FFF auxiliary finder pool is not initialized

Error message

FFF auxiliary finder pool is not initialized

What it means

The auxiliary finder pool (`auxPool`) is null when a path-constrained find/grep needs a scoped picker for a subdirectory. `auxPool` is created alongside the factory in `initializeFinderFactories()` and destroyed in `destroyFinder()`. The guard prevents acquiring pickers from a torn-down pool.

Solutions

  1. Re-initialize the extension/session before issuing path-constrained find/grep calls
  2. Avoid sharing tool handles across session lifecycles; create one extension instance per session
  3. Check that session_end/teardown isn't triggered prematurely (e.g. by cwd-change events) while tools are still in flight
Defensive patterns

Strategy: try-catch

Validate before calling

// verify session is active before path-constrained calls
if (!sessionActive) await startSession();

Try / catch

try { await grepTool.execute(id, { ...p, path }); } catch (e) { if (String(e).includes('pool is not initialized')) { await startSession(); return grepTool.execute(id, { ...p, path }); } throw e; }

Prevention

When it happens

Trigger: Calling the find or grep tool with a `path` parameter (so `resolveFinderForPath` routes through `auxPool.acquire`) after the extension was shut down, or before session initialization.

Common situations: A long-lived agent session emits tool calls after session stop; concurrent sessions where one tears down while the other still queries with path constraints.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of dmtrKovalenko/fff@7f8537e70f (2026-09-10). Data as JSON: /api/errors/e18397aace5c3530. Report an issue: GitHub.

Appendix: source

Thrown at packages/pi-fff/src/index.ts:547

    if (mainFinder && !mainFinder.isDestroyed) {
      mainFinder.destroy();
      mainFinder = null;
      finderCwd = null;
    }

    auxPool?.destroy();
    auxPool = null;
    pickers = null;
  }

  async function resolveFinderForPath(
    pathParam: string | undefined,
    pattern: string,
    exclude: string | string[] | undefined,
  ): Promise<{ finder: FileFinderApi; query: string; root: string } | null> {
    const route = routePathConstraint(pathParam, activeCwd);
    if (!route) return null;
    if (!auxPool) throw new Error("FFF auxiliary finder pool is not initialized");
    const aux = await auxPool.acquire(route.root);
    // A broader covering picker may have been reused; rebase the suffix so the
    // constraint stays relative to the picker's actual root.
    const rebase = nodePath.relative(aux.root, route.root).replaceAll(nodePath.sep, "/");
    const suffix = [rebase, route.suffix].filter(Boolean).join("/");
    const query = buildQuery(suffix || undefined, pattern, exclude, aux.root);
    return { finder: aux.finder, query, root: aux.root };
  }

  async function getMentionItems(
    query: string,
    signal: AbortSignal,
  ): Promise<AutocompleteItem[]> {
    if (signal.aborted) return [];
    const f = await ensureFinder(activeCwd);
    if (signal.aborted) return [];

    const result = f.mixedSearch(query, { pageSize: MENTION_MAX_RESULTS });

View on GitHub (pinned to 7f8537e70f)