{"record":{"id":"6503c37ac7a52734","repo":"can1357/oh-my-pi","slug":"aborted-6503c3","errorCode":null,"errorMessage":"Aborted","messagePattern":"Aborted","errorType":"exception","errorClass":"DOMException","httpStatus":null,"severity":"warning","filePath":"packages/utils/src/glob.ts","lineNumber":169,"sourceCode":"\t// Combine timeout and abort signals\n\tconst timeoutSignal = timeoutMs ? AbortSignal.timeout(timeoutMs) : undefined;\n\tconst combinedSignal =\n\t\tsignal && timeoutSignal ? AbortSignal.any([signal, timeoutSignal]) : (signal ?? timeoutSignal);\n\n\tfor (const pattern of patternArray) {\n\t\tconst glob = new Glob(pattern);\n\t\tconst scanOptions = {\n\t\t\tcwd: base,\n\t\t\tdot,\n\t\t\tonlyFiles,\n\t\t\tthrowErrorOnBrokenSymlink: false,\n\t\t};\n\n\t\tfor await (const entry of glob.scan(scanOptions)) {\n\t\t\tif (combinedSignal?.aborted) {\n\t\t\t\tconst reason = combinedSignal.reason;\n\t\t\t\tif (reason instanceof Error) throw reason;\n\t\t\t\tthrow new DOMException(\"Aborted\", \"AbortError\");\n\t\t\t}\n\n\t\t\t// Check exclusion patterns\n\t\t\tconst normalized = entry.replace(/\\\\/g, \"/\");\n\t\t\tlet excluded = false;\n\t\t\tfor (const excludePattern of effectiveExclude) {\n\t\t\t\tconst excludeGlob = new Glob(excludePattern);\n\t\t\t\tif (excludeGlob.match(normalized)) {\n\t\t\t\t\texcluded = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!excluded) {\n\t\t\t\tallResults.push(normalized);\n\t\t\t}\n\t\t}\n\t}\n","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/glob.ts#L151-L187","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nconst files = await globPaths(\"**/*\", { timeoutMs: 2000 });\n// after\nconst files = await globPaths(\"src/**/*.ts\", { timeoutMs: 30000 });\ntry {\n  await globPaths(pattern, { signal });\n} catch (err) {\n  if (err instanceof DOMException && err.name === \"AbortError\") return [];\n  throw err;\n}","handlingStrategy":"try-catch","validationCode":"if (signal?.aborted) return [];\nconst timeoutMs = 30_000; // generous for large trees","typeGuard":"function isGlobAbort(err: unknown): boolean {\n  return err instanceof DOMException && (err.name === \"AbortError\" || err.name === \"TimeoutError\");\n}","tryCatchPattern":"try {\n  return await globPaths(pattern, { signal, timeoutMs });\n} catch (err) {\n  if (isGlobAbort(err)) return partialResults ?? [];\n  throw err;\n}","preventionTips":["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"],"tags":["abort","glob","timeout","filesystem"],"backgroundTag":"operation-aborted","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}