langgenius/dify · error · IndexingEstimateError

indexing_estimate_error

indexing_estimate_error

Error message

str(e)

What it means

IndexingEstimateError (HTTP 500, error_code=indexing_estimate_error) — the catch-all in the single-document estimate handler. Any Exception that is not LLMBadRequestError / ProviderTokenNotInitError / PluginDaemonClientSideError is re-raised as IndexingEstimateError with str(e). It signals an unexpected failure inside IndexingRunner.indexing_estimate (extract, split, embed, vector-store paths).

Source

Thrown at api/controllers/console/datasets/datasets_document.py:771

                            total_price=0,
                            currency="USD",
                            total_segments=estimate_response.total_segments,
                            preview=estimate_response.preview,
                            qa_preview=estimate_response.qa_preview,
                        ).model_dump(mode="json", exclude_none=True),
                        200,
                    )
                except LLMBadRequestError:
                    raise ProviderNotInitializeError(
                        "No Embedding Model available. Please configure a valid provider "
                        "in the Settings -> Model Provider."
                    )
                except ProviderTokenNotInitError as ex:
                    raise ProviderNotInitializeError(ex.description)
                except PluginDaemonClientSideError as ex:
                    raise ProviderNotInitializeError(ex.description)
                except Exception as e:
                    raise IndexingEstimateError(str(e))

        return (
            IndexingEstimateResponse(
                tokens=0,
                total_price=0,
                currency="USD",
                total_segments=0,
                preview=[],
            ).model_dump(mode="json", exclude_none=True),
            200,
        )


@console_ns.route("/datasets/<uuid:dataset_id>/batch/<string:batch>/indexing-estimate")
class DocumentBatchIndexingEstimateApi(DocumentResource):
    @console_ns.response(
        200,
        "Indexing estimate calculated successfully",

View on GitHub (pinned to ef8544b173)

Solutions

  1. Inspect server logs — the str(e) message and original traceback identify the real cause.
  2. Reproduce by running the estimate on a different document of the same type to isolate document-specific vs. systemic failure.
  3. Validate the source file is parseable locally before retrying.
  4. Confirm the vector store is reachable and credentials valid.
  5. If it looks like a bug, open an issue with the document id, file type, and the underlying traceback.
Defensive patterns

Strategy: try-catch

Validate before calling

import requests

def document_likely_parseable(doc: dict) -> bool:
    # crude guard: skip obviously unsupported mime types
    bad_exts = {'.exe', '.bin', '.dmg', '.iso'}
    name = doc.get('name', '')
    return not any(name.lower().endswith(ext) for ext in bad_exts)

# fetch document meta and guard before estimating
r = requests.get(f"{base}/console/api/datasets/{dataset_id}/documents/{document_id}",
                 headers=hdrs)
r.raise_for_status()
if not document_likely_parseable(r.json()):
    raise SystemExit('document type is unlikely to parse; skip estimate')

Type guard

def is_parseable_doc(doc: dict) -> bool:
    bad = {'.exe', '.bin', '.dmg', '.iso'}
    return not any(doc.get('name', '').lower().endswith(e) for e in bad)

Try / catch

try:
    r = requests.get(f"{base}/console/api/datasets/{dataset_id}/documents/{document_id}/indexing-estimate",
                     headers=hdrs)
    r.raise_for_status()
except requests.HTTPError as e:
    body = e.response.json() if e.response.is_json else {}
    if body.get('code') == 'indexing_estimate_error':
        # surface the underlying str(e) to logs; do not retry blindly
        log.error('estimate failed: %s', body.get('message'))
        report_for_investigation(dataset_id, document_id, body.get('message'))
    else:
        raise

Prevention

When it happens

Trigger: GET .../indexing-estimate on a document whose extraction or processing throws — corrupt upload, unsupported encoding, vector store connectivity failure, segmentation assertion, OCR fallback crash.

Common situations: Unsupported / corrupted file type; downstream vector DB unreachable; bug in the estimator; missing optional dependency for a parser; transient storage failure.

Related errors


AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12). Data as JSON: /api/errors/325820251057291b. Report an issue: GitHub.