{"record":{"id":"97be553aa71c7e2b","repo":"langgenius/dify","slug":"data-source-type-not-support-97be55","errorCode":null,"errorMessage":"Data source type not support","messagePattern":"Data source type not support","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"api/controllers/console/datasets/datasets_document.py","lineNumber":875,"sourceCode":"                        continue\n                    extract_setting = ExtractSetting(\n                        datasource_type=DatasourceType.WEBSITE,\n                        website_info=WebsiteInfo.model_validate(\n                            {\n                                \"provider\": data_source_info[\"provider\"],\n                                \"job_id\": data_source_info[\"job_id\"],\n                                \"url\": data_source_info[\"url\"],\n                                \"tenant_id\": current_tenant_id,\n                                \"mode\": data_source_info[\"mode\"],\n                                \"only_main_content\": data_source_info[\"only_main_content\"],\n                            }\n                        ),\n                        document_model=document.doc_form,\n                    )\n                    extract_settings.append(extract_setting)\n\n                case _:\n                    raise ValueError(\"Data source type not support\")\n            indexing_runner = IndexingRunner()\n            try:\n                response = indexing_runner.indexing_estimate(\n                    tenant_id=current_tenant_id,\n                    extract_settings=extract_settings,\n                    tmp_processing_rule=data_process_rule_dict,\n                    doc_form=document.doc_form,\n                    doc_language=\"English\",\n                    dataset_id=dataset_id_str,\n                    session=session,\n                )\n                return (\n                    IndexingEstimateResponse(\n                        tokens=0,\n                        total_price=0,\n                        currency=\"USD\",\n                        total_segments=response.total_segments,\n                        preview=response.preview,","sourceCodeStart":857,"sourceCodeEnd":893,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/datasets/datasets_document.py#L857-L893","documentation":"Built-in ValueError (uncaught -> HTTP 500) raised in the batch estimate handler's match/case default arm. document.data_source_type is not one of upload_file / notion_import / website_crawl, so the controller cannot build an ExtractSetting and bails. Indicates a data_source_type value the handler was not updated to support.","triggerScenarios":"GET .../batch/{batch}/indexing-estimate over a batch containing a document whose data_source_type is something other than the three handled types (e.g., a newly introduced or custom datasource).","commonSituations":"New datasource type shipped without updating this estimate handler; legacy row with a typo in data_source_type; custom plugin injecting an unhandled type.","solutions":["Identify the offending data_source_type via the document row (SELECT data_source_type FROM documents WHERE id=...).","Exclude documents of that type from the batch estimate, or handle them separately.","If the type is a shipped datasource, file a bug — the handler needs a matching case.","Correct corrupted data_source_type values in the DB if they are typos."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"SUPPORTED_DATA_SOURCES = {'upload_file', 'notion_import', 'website_crawl'}\n\ndef batch_data_sources_supported(docs: list[dict]) -> bool:\n    return all(d.get('data_source_type') in SUPPORTED_DATA_SOURCES for d in docs)\n\n# fetch batch documents and guard before estimating\nr = requests.get(f\"{base}/console/api/datasets/{dataset_id}/batch/{batch}/indexing-status\",\n                 headers=hdrs)\nr.raise_for_status()\nif not batch_data_sources_supported(r.json().get('data', [])):\n    raise SystemExit('batch contains an unsupported data_source_type; split the batch')","typeGuard":"def is_supported_data_source(ds_type: str) -> bool:\n    return ds_type in {'upload_file', 'notion_import', 'website_crawl'}","tryCatchPattern":"try:\n    r = requests.get(f\"{base}/console/api/datasets/{dataset_id}/batch/{batch}/indexing-estimate\",\n                     headers=hdrs)\n    r.raise_for_status()\nexcept requests.HTTPError as e:\n    if e.response.status_code == 500 and 'Data source type not support' in e.response.text:\n        # split the batch to only supported data_source_types and retry\n        supported = [d for d in fetch_batch(dataset_id, batch)\n                     if d['data_source_type'] in SUPPORTED_DATA_SOURCES]\n        # report unsupported ones as a bug if they look like shipped datasources\n    else:\n        raise","preventionTips":["Don't introduce new data_source_type values without extending the estimate handler's match/case.","Validate batch data_source_types client-side before estimating.","Treat 517 as an internal-error / bug, not a retry candidate.","Keep the SUPPORTED set in sync with the controller's match arms."],"tags":["datasets","data-source","switch-statement","internal-error","batch"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}