{"record":{"id":"c431dc8e0c48cc92","repo":"BerriAI/litellm","slug":"model-is-not-allowed-when-require-managed-files-is","errorCode":null,"errorMessage":"model is not allowed when require_managed_files is enabled in litellm_settings. Uploads must go through managed files using target_model_names instead of the model parameter.","messagePattern":"model is not allowed when require_managed_files is enabled in litellm_settings\\. Uploads must go through managed files using target_model_names instead of the model parameter\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/openai_files_endpoints/common_utils.py","lineNumber":914,"sourceCode":"    from fastapi import HTTPException\n\n    import litellm\n\n    if litellm.require_managed_files is not True:\n        return\n\n    if not target_model_names:\n        raise HTTPException(\n            status_code=400,\n            detail=(\n                \"target_model_names is required when require_managed_files is enabled \"\n                \"in litellm_settings. Provide one or more model aliases via the \"\n                \"target_model_names form field (e.g. target_model_names=my-model-alias).\"\n            ),\n        )\n\n    if model:\n        raise HTTPException(\n            status_code=400,\n            detail=(\n                \"model is not allowed when require_managed_files is enabled in \"\n                \"litellm_settings. Uploads must go through managed files using \"\n                \"target_model_names instead of the model parameter.\"\n            ),\n        )\n\n\nasync def validate_managed_id_requirement(\n    resource_id: str | None,\n    resource_kind: Literal[\"file\", \"batch\", \"fine-tuning job\"],\n    user_api_key_dict: \"UserAPIKeyAuth\",\n    managed_files_obj: object | None,\n) -> None:\n    \"\"\"\n    Enforce proxy-level managed resources on every route that accepts a provider-issued id\n    when ``litellm.require_managed_files`` is enabled, and authenticate managed ids against","sourceCodeStart":896,"sourceCodeEnd":932,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/openai_files_endpoints/common_utils.py#L896-L932","documentation":"Error \"model is not allowed when require_managed_files is enabled in litellm_settings. Uploads must go through managed files using target_model_names instead of the model parameter.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/openai_files_endpoints/common_utils.py:914 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the model parameter and upload via managed files using target_model_names instead."],"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-14T05:17:10.506Z"}