can1357/oh-my-pi · warning · DOMException
Aborted
Error message
Aborted
What it means
globPaths combines the caller's AbortSignal with an optional timeout signal via AbortSignal.any, and checks the combined signal inside the scan loop. On abort it rethrows the signal's reason if it is an Error; otherwise it throws DOMException('Aborted', 'AbortError'). This is the library surfacing cancellation/timeout of the glob scan to the caller, as documented on the function.
Source
Thrown at packages/utils/src/glob.ts:169
// Combine timeout and abort signals
const timeoutSignal = timeoutMs ? AbortSignal.timeout(timeoutMs) : undefined;
const combinedSignal =
signal && timeoutSignal ? AbortSignal.any([signal, timeoutSignal]) : (signal ?? timeoutSignal);
for (const pattern of patternArray) {
const glob = new Glob(pattern);
const scanOptions = {
cwd: base,
dot,
onlyFiles,
throwErrorOnBrokenSymlink: false,
};
for await (const entry of glob.scan(scanOptions)) {
if (combinedSignal?.aborted) {
const reason = combinedSignal.reason;
if (reason instanceof Error) throw reason;
throw new DOMException("Aborted", "AbortError");
}
// Check exclusion patterns
const normalized = entry.replace(/\\/g, "/");
let excluded = false;
for (const excludePattern of effectiveExclude) {
const excludeGlob = new Glob(excludePattern);
if (excludeGlob.match(normalized)) {
excluded = true;
break;
}
}
if (!excluded) {
allResults.push(normalized);
}
}
}
View on GitHub (pinned to 9690622007)
Solutions
- Increase timeoutMs or remove it for large trees
- Catch DOMException with name 'AbortError' (and TimeoutError) and treat as cancellation
- Narrow the glob patterns/excludes so scans complete quickly
- Check the caller-side signal for premature aborts
Example fix
// before
const files = await globPaths("**/*", { timeoutMs: 2000 });
// after
const files = await globPaths("src/**/*.ts", { timeoutMs: 30000 });
try {
await globPaths(pattern, { signal });
} catch (err) {
if (err instanceof DOMException && err.name === "AbortError") return [];
throw err;
} Defensive patterns
Strategy: try-catch
Validate before calling
if (signal?.aborted) return []; const timeoutMs = 30_000; // generous for large trees
Type guard
function isGlobAbort(err: unknown): boolean {
return err instanceof DOMException && (err.name === "AbortError" || err.name === "TimeoutError");
} Try / catch
try {
return await globPaths(pattern, { signal, timeoutMs });
} catch (err) {
if (isGlobAbort(err)) return partialResults ?? [];
throw err;
} Prevention
- Set timeoutMs generously relative to tree size
- Use narrow patterns and exclude heavy dirs (node_modules is excluded by default unless referenced)
- Check signal.aborted before launching
- Treat AbortError/TimeoutError as control flow, not failures
When it happens
Trigger: Passing a signal that gets aborted mid-scan, or timeoutMs elapsing before the scan finishes (AbortSignal.timeout produces a TimeoutError/DOMException reason; a plain aborted signal with a non-Error reason produces this 'Aborted' DOMException).
Common situations: Scanning a very large repository (node_modules included via pattern) exceeding timeoutMs; user cancels a file search; upstream operation cancellation propagates its signal into globPaths.
Related errors
- No files matched "${pattern}"
- completion() request aborted.
- ${isTimedOutJuliaCancellation(executionOptions.signal.reason
- Timed out initializing daemon broker token in ${runtimeDir}
- ToolAbortError (operation aborted)
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/6503c37ac7a52734.
Report an issue: GitHub.