{"record":{"id":"0a676ba5b76b6cd4","repo":"BerriAI/litellm","slug":"target-model-names-on-list-files-must-be-a-list-of","errorCode":null,"errorMessage":"target_model_names on list files must be a list of one model name. Example: ['gpt-4o']","messagePattern":"target_model_names on list files must be a list of one model name\\. Example: \\['gpt-4o'\\]","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/openai_files_endpoints/files_endpoints.py","lineNumber":1369,"sourceCode":"            data=data,\n            check_file_id_encoding=False,\n        )\n\n        if should_route and credentials is not None:\n            # Use model-based routing with credentials from config\n            prepare_data_with_credentials(data=data, credentials=credentials)\n            response = await litellm.afile_list(\n                custom_llm_provider=credentials[\"custom_llm_provider\"],\n                purpose=purpose,\n                **data,\n            )\n\n            verbose_proxy_logger.debug(\"Listed files using model: %s\", model_used)\n\n        elif target_model_names and isinstance(target_model_names, str):\n            target_model_names_list: Final = target_model_names.split(\",\")\n            if len(target_model_names_list) != 1:\n                raise HTTPException(\n                    status_code=400,\n                    detail=\"target_model_names on list files must be a list of one model name. Example: ['gpt-4o']\",\n                )\n            if llm_router is None:\n                raise HTTPException(\n                    status_code=500,\n                    detail=\"LLM Router not initialized. Ensure models added to proxy.\",\n                )\n            credentials = get_credentials_for_model(\n                llm_router=llm_router,\n                model_id=target_model_names_list[0],\n                operation_context=\"file list\",\n            )\n            prepare_data_with_credentials(data=data, credentials=credentials)\n            response = await litellm.afile_list(\n                custom_llm_provider=credentials[\"custom_llm_provider\"],\n                purpose=purpose,\n                **data,","sourceCodeStart":1351,"sourceCodeEnd":1387,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/openai_files_endpoints/files_endpoints.py#L1351-L1387","documentation":"HTTPException(400) raised when listing files: target_model_names was supplied but does not contain exactly one model name (empty, multiple entries, or wrong type). Model-based routing for file listing only supports a single pinned deployment.","triggerScenarios":"Thrown at litellm/proxy/openai_files_endpoints/files_endpoints.py:1369 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass target_model_names as a list containing exactly one model name, e.g. ['gpt-4o']."],"exampleFix":null,"handlingStrategy":"validation","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"}