{"record":{"id":"fdd48e3d14c14068","repo":"BerriAI/litellm","slug":"file-data-is-required","errorCode":null,"errorMessage":"File data is required","messagePattern":"File data is required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/anthropic/files/transformation.py","lineNumber":141,"sourceCode":"        return optional_params\n\n    def transform_create_file_request(\n        self,\n        model: str,\n        create_file_data: CreateFileRequest,\n        optional_params: dict,\n        litellm_params: dict,\n    ) -> dict:\n        \"\"\"\n        Transform to multipart form data for Anthropic file upload.\n\n        Anthropic expects: POST /v1/files with multipart form-data\n        - file: the file content\n        - purpose: \"messages\" (defaults to \"messages\" if not provided)\n        \"\"\"\n        file_data: Final = create_file_data.get(\"file\")\n        if file_data is None:\n            raise ValueError(\"File data is required\")\n\n        extracted: Final = extract_file_data(file_data)\n        filename: Final = extracted[\"filename\"] or f\"file_{int(time.time())}\"\n        content: Final = extracted[\"content\"]\n        content_type: Final = extracted.get(\"content_type\", \"application/octet-stream\")\n\n        purpose: Final = create_file_data.get(\"purpose\", \"messages\")\n\n        return {\n            \"file\": (filename, content, content_type),\n            \"purpose\": (None, purpose),\n        }\n\n    def transform_create_file_response(\n        self,\n        model: str | None,\n        raw_response: httpx.Response,\n        logging_obj: LiteLLMLoggingObj,","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/anthropic/files/transformation.py#L123-L159","documentation":"Error \"File data is required\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/anthropic/files/transformation.py:141 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide the file data (bytes or file-like object) in the upload request."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}