run-llama/liteparse · error · ValueError

parse_timeout requires pool_size

Error message

parse_timeout requires pool_size

What it means

ValueError raised by the LiteParse constructor when parse_timeout is given but pool_size is omitted. The timeout is implemented by killing worker processes, so it only exists in the process-pool mode; without a pool there is no worker to enforce it against.

Solutions

  1. Pass pool_size (>= 1) together with parse_timeout
  2. Remove parse_timeout if you do not want the process pool and implement your own deadline around parse() instead
  3. Note init time is excluded from parse_timeout — only the parse itself is bounded

Example fix

// before
parser = LiteParse(parse_timeout=30)

// after
parser = LiteParse(pool_size=2, parse_timeout=30)
Defensive patterns

Strategy: validation

Validate before calling

def make_parser(pool_size=None, parse_timeout=None):
    if parse_timeout is not None and pool_size is None:
        raise ValueError("parse_timeout requires pool_size")
    return LiteParse(pool_size=pool_size, parse_timeout=parse_timeout)

Try / catch

try:
    parser = LiteParse(parse_timeout=timeout)
except ValueError as e:
    if "parse_timeout requires pool_size" in str(e):
        parser = LiteParse(pool_size=2, parse_timeout=timeout)
    else:
        raise

Prevention

When it happens

Trigger: LiteParse(parse_timeout=30) without pool_size — the validation at parser.py:659 fires immediately at construction time.

Common situations: Copy-pasting timeout config from pooled examples into non-pooled code; adding parse_timeout to tune latency but forgetting it requires opting into the worker pool; refactors that removed pool_size while keeping the timeout.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of run-llama/liteparse@22d2dd8cd7 (2026-09-08). Data as JSON: /api/errors/3ee71c5a50729b16. Report an issue: GitHub.

Appendix: source

Thrown at packages/python/liteparse/parser.py:659

        if ocr_hedge_delays_ms is not None:
            kwargs["ocr_hedge_delays_ms"] = ocr_hedge_delays_ms
        if emit_word_boxes is not None:
            kwargs["emit_word_boxes"] = emit_word_boxes
        if extract_text_metadata is not None:
            kwargs["extract_text_metadata"] = extract_text_metadata
        if crop_box is not None:
            kwargs["crop_box"] = crop_box
        if skip_diagonal_text is not None:
            kwargs["skip_diagonal_text"] = skip_diagonal_text
        if include_complexity is not None:
            kwargs["include_complexity"] = include_complexity
        if extract_vector_graphics is not None:
            kwargs["extract_vector_graphics"] = extract_vector_graphics

        self._native = _NativeLiteParse(**kwargs)

        if parse_timeout is not None and pool_size is None:
            raise ValueError(
                "parse_timeout requires pool_size"
            )
        self._pool = None
        if pool_size is not None:
            from ._pool import WorkerPool

            self._pool = WorkerPool(kwargs, pool_size, parse_timeout)

    def close(self) -> None:
        """Shut down pool workers, if pool mode is enabled. Idempotent.

        Without ``pool_size`` this is a no-op. Workers also exit on their own
        when the parent process does, so forgetting to call this leaks
        nothing past interpreter exit.
        """
        if self._pool is not None:
            self._pool.close()

View on GitHub (pinned to 22d2dd8cd7)