diegosouzapw/OmniRoute · error
[PII] Blocked response due to PII detection
Error message
[PII] Blocked response due to PII detection
What it means
Error "[PII] Blocked response due to PII detection" thrown in diegosouzapw/OmniRoute.
Source
Thrown at src/lib/piiSanitizer.ts:239
pattern: name,
count,
severity: patternDef?.severity || "medium",
});
}
if (detections.length > 0) {
if (mode === "warn") {
console.warn(
`[PII] Detected PII in response: ${detections.map((d) => `${d.pattern}(${d.count})`).join(", ")}`
);
} else if (mode === "block") {
// Log the matched pattern types server-side, but never put them in the
// thrown message — it can surface to the client via controller.error
// (Hard Rule #12: no internal detail in response/stream errors).
console.warn(
`[PII] Blocked response due to PII detection: ${detections.map((d) => d.pattern).join(", ")}`
);
throw new Error("[PII] Blocked response due to PII detection");
}
}
let sanitized = text;
if (mode === "redact" && ranges.length > 0) {
// Sort ranges from right to left to avoid shifting offsets
ranges.sort((a, b) => b.start - a.start);
// Merge overlapping or adjacent ranges
const mergedRanges: typeof ranges = [];
for (const r of ranges) {
if (mergedRanges.length === 0) {
mergedRanges.push(r);
} else {
const last = mergedRanges[mergedRanges.length - 1];
if (r.end >= last.start) {
last.start = Math.min(r.start, last.start);
last.end = Math.max(r.end, last.end);View on GitHub (pinned to a179ffed5b)
When it happens
Trigger: Thrown at src/lib/piiSanitizer.ts:239 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/7b140e11e18219aa.
Report an issue: GitHub.