{"record":{"id":"325820251057291b","repo":"langgenius/dify","slug":"indexing-estimate-error","errorCode":"indexing_estimate_error","errorMessage":"str(e)","messagePattern":"str\\(e\\)","errorType":"error_code","errorClass":"IndexingEstimateError","httpStatus":500,"severity":"error","filePath":"api/controllers/console/datasets/datasets_document.py","lineNumber":771,"sourceCode":"                            total_price=0,\n                            currency=\"USD\",\n                            total_segments=estimate_response.total_segments,\n                            preview=estimate_response.preview,\n                            qa_preview=estimate_response.qa_preview,\n                        ).model_dump(mode=\"json\", exclude_none=True),\n                        200,\n                    )\n                except LLMBadRequestError:\n                    raise ProviderNotInitializeError(\n                        \"No Embedding Model available. Please configure a valid provider \"\n                        \"in the Settings -> Model Provider.\"\n                    )\n                except ProviderTokenNotInitError as ex:\n                    raise ProviderNotInitializeError(ex.description)\n                except PluginDaemonClientSideError as ex:\n                    raise ProviderNotInitializeError(ex.description)\n                except Exception as e:\n                    raise IndexingEstimateError(str(e))\n\n        return (\n            IndexingEstimateResponse(\n                tokens=0,\n                total_price=0,\n                currency=\"USD\",\n                total_segments=0,\n                preview=[],\n            ).model_dump(mode=\"json\", exclude_none=True),\n            200,\n        )\n\n\n@console_ns.route(\"/datasets/<uuid:dataset_id>/batch/<string:batch>/indexing-estimate\")\nclass DocumentBatchIndexingEstimateApi(DocumentResource):\n    @console_ns.response(\n        200,\n        \"Indexing estimate calculated successfully\",","sourceCodeStart":753,"sourceCodeEnd":789,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/datasets/datasets_document.py#L753-L789","documentation":"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).","triggerScenarios":"GET .../indexing-estimate on a document whose extraction or processing throws — corrupt upload, unsupported encoding, vector store connectivity failure, segmentation assertion, OCR fallback crash.","commonSituations":"Unsupported / corrupted file type; downstream vector DB unreachable; bug in the estimator; missing optional dependency for a parser; transient storage failure.","solutions":["Inspect server logs — the str(e) message and original traceback identify the real cause.","Reproduce by running the estimate on a different document of the same type to isolate document-specific vs. systemic failure.","Validate the source file is parseable locally before retrying.","Confirm the vector store is reachable and credentials valid.","If it looks like a bug, open an issue with the document id, file type, and the underlying traceback."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import requests\n\ndef document_likely_parseable(doc: dict) -> bool:\n    # crude guard: skip obviously unsupported mime types\n    bad_exts = {'.exe', '.bin', '.dmg', '.iso'}\n    name = doc.get('name', '')\n    return not any(name.lower().endswith(ext) for ext in bad_exts)\n\n# fetch document meta and guard before estimating\nr = requests.get(f\"{base}/console/api/datasets/{dataset_id}/documents/{document_id}\",\n                 headers=hdrs)\nr.raise_for_status()\nif not document_likely_parseable(r.json()):\n    raise SystemExit('document type is unlikely to parse; skip estimate')","typeGuard":"def is_parseable_doc(doc: dict) -> bool:\n    bad = {'.exe', '.bin', '.dmg', '.iso'}\n    return not any(doc.get('name', '').lower().endswith(e) for e in bad)","tryCatchPattern":"try:\n    r = requests.get(f\"{base}/console/api/datasets/{dataset_id}/documents/{document_id}/indexing-estimate\",\n                     headers=hdrs)\n    r.raise_for_status()\nexcept requests.HTTPError as e:\n    body = e.response.json() if e.response.is_json else {}\n    if body.get('code') == 'indexing_estimate_error':\n        # surface the underlying str(e) to logs; do not retry blindly\n        log.error('estimate failed: %s', body.get('message'))\n        report_for_investigation(dataset_id, document_id, body.get('message'))\n    else:\n        raise","preventionTips":["Don't retry on indexing_estimate_error — read str(e) and act on the cause.","Validate the file is parseable before requesting an estimate.","Confirm the vector store is reachable and credentials valid.","Keep optional parser dependencies installed (unstructured, pandoc, etc.)."],"tags":["estimate","indexing","internal-error","datasets","catch-all"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}