{"record":{"id":"d22aebd7f5e4b80f","repo":"crewAIInc/crewAI","slug":"invalid-data-type-raw-data-type-valid-values","errorCode":null,"errorMessage":"Invalid data_type: '{raw_data_type}'. Valid values are: 'file' (auto-detect), or one of: {', '.join(dt.value for dt in DataType)}","messagePattern":"Invalid data_type: '(.+?)'\\. Valid values are: 'file' \\(auto-detect\\), or one of: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/adapters/crewai_rag_adapter.py","lineNumber":159,"sourceCode":"        from crewai_tools.rag.base_loader import LoaderResult\n        from crewai_tools.rag.data_types import DataType, DataTypes\n        from crewai_tools.rag.source_content import SourceContent\n\n        documents: list[BaseRecord] = []\n        raw_data_type = kwargs.get(\"data_type\")\n        base_metadata: dict[str, Any] = kwargs.get(\"metadata\", {})\n\n        data_type: DataType | None = None\n        if raw_data_type is not None:\n            if isinstance(raw_data_type, DataType):\n                if raw_data_type != DataType.FILE:\n                    data_type = raw_data_type\n            elif isinstance(raw_data_type, str):\n                if raw_data_type != \"file\":\n                    try:\n                        data_type = DataType(raw_data_type)\n                    except ValueError:\n                        raise ValueError(\n                            f\"Invalid data_type: '{raw_data_type}'. \"\n                            f\"Valid values are: 'file' (auto-detect), or one of: \"\n                            f\"{', '.join(dt.value for dt in DataType)}\"\n                        ) from None\n\n        content_items: list[ContentItem] = list(args)\n\n        path_value = kwargs.get(\"path\") or kwargs.get(\"file_path\")\n        if path_value is not None:\n            content_items.append(path_value)\n\n        if url := kwargs.get(\"url\"):\n            content_items.append(url)\n        if website := kwargs.get(\"website\"):\n            content_items.append(website)\n        if github_url := kwargs.get(\"github_url\"):\n            content_items.append(github_url)\n        if youtube_url := kwargs.get(\"youtube_url\"):","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/adapters/crewai_rag_adapter.py#L141-L177","documentation":"ValueError raised while parsing the data_type argument passed to the RAG adapter's add-content API. String values are mapped through the DataType enum; the sentinel string 'file' means auto-detect and is skipped, and passing a DataType instance is accepted. Any other string that is not an enum value raises this error listing the valid options.","triggerScenarios":"Calling the adapter with data_type='pdf_file' when the enum value is actually 'pdf_file' vs 'PDF_FILE' mismatch, or a typo like 'pdf', 'doc', 'csv_file', 'website' that is not a DataType member.","commonSituations":"Guessing type names instead of checking DataType values; version drift when enum member names changed between releases; passing 'file' variants like 'files' or 'auto'.","solutions":["Use the enum directly: from the data types module, pass DataType.PDF_FILE (or its exact string value) instead of guessing.","Omit data_type entirely to use auto-detection from the content/extension.","Print valid values once to discover exact names: [dt.value for dt in DataType]."],"exampleFix":"# before\nadapter(\"report.pdf\", data_type=\"pdf\")  # ValueError: Invalid data_type\n\n# after\nadapter(\"report.pdf\", data_type=DataType.PDF_FILE)\n# or simply omit for auto-detection:\nadapter(\"report.pdf\")","handlingStrategy":"validation","validationCode":"from crewai_tools.adapters.crewai_rag_adapter import DataType  # adjust to real export\n\nvalid = {dt.value for dt in DataType}\nif isinstance(data_type, str) and data_type != \"file\" and data_type not in valid:\n    raise ValueError(f\"bad data_type {data_type!r}; choose from {sorted(valid)}\")","typeGuard":"def is_valid_data_type(value: object) -> bool:\n    if isinstance(value, DataType):\n        return True\n    return isinstance(value, str) and (value == \"file\" or value in {dt.value for dt in DataType})","tryCatchPattern":null,"preventionTips":["Pass DataType enum members instead of strings.","Omit data_type to use auto-detection for file inputs.","Pin the crewai-tools version so enum values can't drift silently."],"tags":["rag","validation","enum","data-type","crewai-tools"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}