diegosouzapw/OmniRoute · error

lines requires positive 'start' and 'end' (1-indexed)

Error message

lines requires positive 'start' and 'end' (1-indexed)

What it means

Error "lines requires positive 'start' and 'end' (1-indexed)" thrown in diegosouzapw/OmniRoute.

Source

Thrown at open-sse/services/compression/engines/ccr/ccrQuery.ts:50

  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 {
  if (!pattern) return err("grep requires a 'pattern'");
  if (pattern.length > MAX_PATTERN_LEN) return err(`pattern exceeds ${MAX_PATTERN_LEN} chars`);
  if (!safeRegex(pattern)) return err("pattern rejected: potentially catastrophic backtracking");
  let re: RegExp;
  try {
    re = new RegExp(pattern);
  } catch {
    return err("invalid regex pattern");
  }
  const matched: string[] = [];
  let truncated = false;
  for (const line of lines) {

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at open-sse/services/compression/engines/ccr/ccrQuery.ts:50 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/d588ad1ac6d91832. Report an issue: GitHub.