{"record":{"id":"9a4074747fea2d39","repo":"BerriAI/litellm","slug":"invalid-environment-environment-please-use-one","errorCode":null,"errorMessage":"Invalid environment: {environment}. Please use one of the following instead: {valid_values}","messagePattern":"Invalid environment: (.+?)\\. Please use one of the following instead: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/deepeval/utils.py","lineNumber":14,"sourceCode":"from datetime import datetime, timezone\nfrom typing import Final\n\nfrom litellm.integrations.deepeval.types import Environment\n\n\ndef to_zod_compatible_iso(dt: datetime) -> str:\n    return dt.astimezone(timezone.utc).isoformat(timespec=\"milliseconds\").replace(\"+00:00\", \"Z\")\n\n\ndef validate_environment(environment: str):\n    if environment not in [env.value for env in Environment]:\n        valid_values: Final = \", \".join(f'\"{env.value}\"' for env in Environment)\n        raise ValueError(f\"Invalid environment: {environment}. Please use one of the following instead: {valid_values}\")\n","sourceCodeStart":1,"sourceCodeEnd":15,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/deepeval/utils.py#L1-L15","documentation":"DeepEval integration tags traces with an environment label taken from LITELLM_ENVIRONMENT (default 'development'). validate_environment checks the value against the Environment enum — production, development, staging — and raises ValueError for anything else, listing the allowed values in the message. It runs during DeepEvalLogger construction, before any API call.","triggerScenarios":"Setting LITELLM_ENVIRONMENT to a value outside {production, development, staging} — e.g. 'prod', 'dev', 'staging-eu', 'Production' (case-sensitive) — and then instantiating DeepEvalLogger.","commonSituations":"Teams already using LITELLM_ENVIRONMENT for their own deploy-stage conventions ('prod'/'dev') who then enable the DeepEval callback; values inherited from other tooling with different vocabularies.","solutions":["Set LITELLM_ENVIRONMENT to exactly 'production', 'development', or 'staging' (lowercase)","Unset it if you are fine with the 'development' default","If your pipeline uses 'prod'/'dev', map it to the allowed value in your env templating before starting litellm"],"exampleFix":"# before\nexport LITELLM_ENVIRONMENT=prod\n\n# after\nexport LITELLM_ENVIRONMENT=production","handlingStrategy":"validation","validationCode":"import os\n\nVALID = {\"production\", \"development\", \"staging\"}\nenv_name = os.getenv(\"LITELLM_ENVIRONMENT\", \"development\")\nassert env_name in VALID, f\"LITELLM_ENVIRONMENT must be one of {VALID}, got {env_name!r}\"","typeGuard":"def is_valid_litellm_environment(value: str) -> bool:\n    return value in {\"production\", \"development\", \"staging\"}","tryCatchPattern":"try:\n    DeepEvalLogger()\nexcept ValueError as e:\n    if \"Invalid environment\" in str(e):\n        os.environ[\"LITELLM_ENVIRONMENT\"] = \"development\"\n        DeepEvalLogger()\n    else:\n        raise","preventionTips":["Map internal stage names ('prod'/'dev') to the allowed enum values in env templating","The check is case-sensitive: always use lowercase 'production'/'development'/'staging'"],"tags":["deepeval","env-vars","validation","config"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}