can1357/oh-my-pi · info · ToolAbortError
ToolAbortError (operation aborted)
Error message
ToolAbortError (operation aborted)
What it means
findUniqueWorkspaceSuffixWithGlob throws ToolAbortError immediately after the glob scan returns when the caller-supplied AbortSignal is aborted. This converts the caller's cancellation into the tool layer's standard abort error, since the native glob may complete without observing the signal.
Source
Thrown at packages/coding-agent/src/tools/path-utils.ts:1398
signal: AbortSignal | undefined,
globImpl: typeof glob,
): Promise<{ absolutePath: string; displayPath: string } | null> {
const normalized = rawPath.replace(/\\/g, "/").replace(/^\.\//, "").replace(/\/+$/, "");
if (!normalized) return null;
const timeoutSignal = AbortSignal.timeout(WORKSPACE_SUFFIX_TIMEOUT_MS);
const combinedSignal = signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal;
let matches: string[];
try {
const result = await globImpl({
pattern: `**/${escapeGlobMetachars(normalized)}`,
path: cwd,
hidden: true,
signal: combinedSignal,
timeoutMs: WORKSPACE_SUFFIX_TIMEOUT_MS,
});
if (signal?.aborted) throw new ToolAbortError();
matches = result.matches.map(match => match.path);
} catch {
if (signal?.aborted) throw new ToolAbortError();
return null;
}
if (matches.length !== 1) return null;
return {
absolutePath: path.resolve(cwd, matches[0]),
displayPath: matches[0],
};
}
/**
* Find a unique workspace entry whose trailing path matches a missing authored path.
* Returns `null` for no match, ambiguity, timeout, or scan failure.
*/
export async function findUniqueWorkspaceSuffix(View on GitHub (pinned to 9690622007)
Solutions
- No fix needed — this is expected cancellation propagation; treat it as the operation being cancelled.
- If it fires unexpectedly, audit who owns the AbortSignal and whether cancellation should still be active at this point.
- If scans are routinely cancelled mid-flight, reduce scan scope or skip the suffix heuristic for very large workspaces.
Defensive patterns
Strategy: try-catch
Try / catch
try {
const hit = await findUniqueWorkspaceSuffix(p, cwd, signal);
} catch (e) {
if (e instanceof ToolAbortError || signal?.aborted) return; // cancelled: stop quietly
throw e;
} Prevention
- Propagate a single AbortSignal per tool invocation and check `signal.aborted` after each await.
- Treat ToolAbortError as normal cancellation in top-level tool handlers.
- Avoid sharing signals across unrelated operations.
When it happens
Trigger: The AbortSignal passed to findUniqueWorkspaceSuffix becomes aborted while (or just after) the `**/<suffix>` glob scan runs, and the glob call itself returns normally — the post-call `signal?.aborted` check at path-utils.ts:1398 fires.
Common situations: User presses Escape / cancels the tool call while the workspace suffix lookup is scanning a large tree; upstream request times out and aborts the shared signal.
Related errors
- aborted
- operation canceled
- Request was aborted
- Auth broker request aborted
- OAuth refresh ownership aborted by caller
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/4601826e6fb3f152.
Report an issue: GitHub.