{"record":{"id":"001ce43c679b16a4","repo":"BerriAI/litellm","slug":"model-deployment-model-info-id-not-found-in-data","errorCode":null,"errorMessage":"Model {deployment.model_info.id} not found in database","messagePattern":"Model (.+?) not found in database","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"litellm/proxy/management_endpoints/tag_management_endpoints.py","lineNumber":365,"sourceCode":"        }\n    except Exception as e:\n        verbose_proxy_logger.exception(\"Error creating tag: %s\", e)\n        raise HTTPException(status_code=500, detail=str(e))\n\n\nasync def _add_tag_to_deployment(deployment: \"Deployment\", tag: str):\n    \"\"\"Helper function to add tag to deployment\"\"\"\n    from litellm.proxy.proxy_server import prisma_client\n\n    if prisma_client is None:\n        raise HTTPException(status_code=500, detail=\"Database not connected\")\n\n    try:\n        # Get current model from database to preserve encrypted fields\n        db_model = await ModelRepository(prisma_client).table.find_unique(where={\"model_id\": deployment.model_info.id})\n\n        if db_model is None:\n            raise HTTPException(\n                status_code=404,\n                detail=f\"Model {deployment.model_info.id} not found in database\",\n            )\n\n        # Prisma returns litellm_params as dict (already parsed from JSON)\n        existing_params = db_model.litellm_params\n        if isinstance(existing_params, str):\n            # If it's a string, parse it\n            existing_params = json.loads(existing_params)\n        elif not isinstance(existing_params, dict):\n            raise Exception(f\"Unexpected litellm_params type: {type(existing_params)}\")\n\n        # Add tag to tags array (preserve encryption of other fields)\n        if \"tags\" not in existing_params:\n            existing_params[\"tags\"] = []\n        if tag not in existing_params[\"tags\"]:\n            existing_params[\"tags\"].append(tag)\n","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/tag_management_endpoints.py#L347-L383","documentation":"The deployment referenced by the tag (deployment.model_info.id) has no row in the LiteLLM_ProxyModelTable; the tag cannot be attached to a model the DB does not know, so a 404 naming the model id is raised.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/tag_management_endpoints.py:365 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the deployment's model id exists in the database via /model/info."],"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"}