HKUDS/DeepTutor · warning · LLMProviderTransportError

The model provider interrupted this response. Please retry.

Error message

The model provider interrupted this response. Please retry.

What it means

Raised as EmptyDocumentError after successful extraction when the resulting text is empty or only whitespace. This means the file parsed fine but genuinely contained no retrievable text — e.g. a scanned/image-only PDF, an empty DOCX, or a spreadsheet of blank cells.

Source

Thrown at deeptutor/agents/chat/agent_loop.py:787

                            "error_code": "provider_transport",
                            "retryable": True,
                            "partial_response": partial_response,
                        },
                    ),
                )
                message = self.pipeline._t(
                    (
                        "notices.provider_stream_interrupted"
                        if partial_response
                        else "notices.provider_unavailable"
                    ),
                    default=(
                        "The model provider interrupted this response. Please retry."
                        if partial_response
                        else "Unable to reach the model provider. Please retry."
                    ),
                )
                raise LLMProviderTransportError(
                    message,
                    partial_response=partial_response,
                ) from exc
            finally:
                close = getattr(response_stream, "close", None)
                if callable(close):
                    with suppress(Exception):
                        await close()
            break

        dsml_tail = dsml_filter.flush()
        if dsml_tail:
            await _emit_segments(think_filter.feed(dsml_tail))
        await _emit_segments(think_filter.flush())
        text = "".join(text_parts)
        record_streamed_usage(
            self.pipeline.usage,
            usage_seen,

View on GitHub (pinned to 3e82f13042)

Solutions

  1. If the file is a scanned PDF, run OCR (e.g. pytesseract/ocrmypdf) before extraction
  2. Pre-check the file: warn users when a document has 0 extractable characters
  3. Catch EmptyDocumentError and skip the file (log it) rather than aborting a batch ingest

Example fix

// before
text = extract_text_from_bytes(data, filename=fn)

// after
from deeptutor.utils.document_extractor import EmptyDocumentError
try:
    text = extract_text_from_bytes(data, filename=fn)
except EmptyDocumentError:
    text = ocr_fallback(data)  # or skip with a warning
    if not text.strip():
        raise
Defensive patterns

Strategy: try-catch

Validate before calling

import fitz
with fitz.open(stream=data, filetype="pdf") as doc:
    if not any(page.get_text().strip() for page in doc):
        warn_user("document has no text layer; OCR needed")

Try / catch

from deeptutor.utils.document_extractor import EmptyDocumentError
try:
    text = extract_text_from_bytes(data, filename=fn)
except EmptyDocumentError:
    text = ""  # treat as empty, run OCR or skip

Prevention

When it happens

Trigger: Extracting a scanned PDF with no text layer; an empty .docx or .xlsx created but never filled; a .txt containing only whitespace/newlines; an EPUB whose chapters contain only images.

Common situations: KB ingestion of scanned books or image-heavy slide decks; users uploading a newly created empty file; OCR-less pipelines feeding image PDFs into a text extractor.

Related errors


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/321a7e0978ff036f. Report an issue: GitHub.