diegosouzapw/OmniRoute · error
head requires a positive 'n'
Error message
head requires a positive 'n'
What it means
Error "head requires a positive 'n'" thrown in diegosouzapw/OmniRoute.
Source
Thrown at open-sse/services/compression/engines/ccr/ccrQuery.ts:38
}
export type CcrQueryResult = { content: string } | { error: string };
export const MAX_RANGE_LINES = 10_000;
export const MAX_GREP_MATCHES = 1_000;
export const MAX_PATTERN_LEN = 512;
const err = (m: string): CcrQueryResult => ({ error: m });
const ok = (c: string): CcrQueryResult => ({ content: c });
function clampCount(n: number | undefined): number | null {
if (typeof n !== "number" || !Number.isFinite(n) || n < 1) return null;
return Math.min(Math.floor(n), MAX_RANGE_LINES);
}
function sliceHead(lines: string[], n: number | undefined): CcrQueryResult {
const c = clampCount(n);
if (c === null) return err("head requires a positive 'n'");
return ok(lines.slice(0, c).join("\n"));
}
function sliceTail(lines: string[], n: number | undefined): CcrQueryResult {
const c = clampCount(n);
if (c === null) return err("tail requires a positive 'n'");
return ok(lines.slice(Math.max(0, lines.length - c)).join("\n"));
}
function sliceLines(lines: string[], start?: number, end?: number): CcrQueryResult {
if (typeof start !== "number" || typeof end !== "number" || start < 1 || end < 1) {
return err("lines requires positive 'start' and 'end' (1-indexed)");
}
if (start > end) return err("lines: 'start' must be <= 'end'");
return ok(lines.slice(start - 1, Math.min(end, lines.length)).join("\n"));
}
function grepLines(lines: string[], pattern?: string, unique?: boolean): CcrQueryResult {View on GitHub (pinned to a179ffed5b)
When it happens
Trigger: Thrown at open-sse/services/compression/engines/ccr/ccrQuery.ts:38 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/061e5c58594ecc90.
Report an issue: GitHub.