{"record":{"id":"82396588d2eebfcf","repo":"reflex-dev/reflex","slug":"invalid-log-level-value-value-for-field-name","errorCode":null,"errorMessage":"Invalid log level value: {value} for {field_name}","messagePattern":"Invalid log level value: (.+?) for (.+?)","errorType":"exception","errorClass":"EnvironmentVarValueError","httpStatus":null,"severity":"error","filePath":"packages/reflex-base/src/reflex_base/environment.py","lineNumber":323,"sourceCode":"        for arg in (union_types := get_args(field_type)):\n            try:\n                return interpret_env_var_value(value, arg, field_name)\n            except (ValueError, EnvironmentVarValueError) as e:  # noqa: PERF203\n                errors.append(e)\n        msg = f\"Could not interpret {value!r} for {field_name} as any of {union_types}: {errors}\"\n        raise EnvironmentVarValueError(msg)\n\n    value = value.strip()\n\n    if field_type is bool:\n        return interpret_boolean_env(value, field_name)\n    if field_type is str:\n        return value\n    if field_type is LogLevel:\n        loglevel = LogLevel.from_string(value)\n        if loglevel is None:\n            msg = f\"Invalid log level value: {value} for {field_name}\"\n            raise EnvironmentVarValueError(msg)\n        return loglevel\n    if field_type is int:\n        return interpret_int_env(value, field_name)\n    if field_type is float:\n        return interpret_float_env(value, field_name)\n    if field_type is Path:\n        if PathExistsFlag in annotated_metadata:\n            return interpret_existing_path_env(value, field_name)\n        return interpret_path_env(value, field_name)\n    if field_type is ExistingPath:\n        return interpret_existing_path_env(value, field_name)\n    if field_type is Plugin:\n        return interpret_plugin_env(value, field_name)\n    if get_origin(field_type) is type:\n        type_args = get_args(field_type)\n        if (\n            type_args\n            and isinstance(type_args[0], type)","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-base/src/reflex_base/environment.py#L305-L341","documentation":"For fields typed as LogLevel, interpret_env_var_value calls LogLevel.from_string(value); an unrecognized string (not a standard level name like 'debug', 'info', 'warning', 'error', 'critical') yields None and raises EnvironmentVarValueError.","triggerScenarios":"Setting a log-level env var to a non-level string: LOG_LEVEL=verbose, LOG_LEVEL=DEBUG???, or with stray whitespace/case issues outside what from_string accepts.","commonSituations":"Using levels from other logging systems ('trace', 'warn' vs 'warning', 'notice'), or copy-paste artifacts in env files.","solutions":["Use a standard level name accepted by LogLevel.from_string (e.g. 'debug', 'info', 'warning', 'error')","Trim whitespace/quotes from the value","If 'trace'/'notice' style levels are needed, map them to the nearest supported level at the deployment layer"],"exampleFix":"# before\nLOG_LEVEL=trace\n# after\nLOG_LEVEL=debug\n","handlingStrategy":"validation","validationCode":"VALID = {\"debug\", \"info\", \"warning\", \"error\", \"critical\"}\nv = os.environ.get(\"LOG_LEVEL\", \"info\").strip().lower()\nassert v in VALID, f\"LOG_LEVEL must be one of {sorted(VALID)}\"","typeGuard":"def is_valid_log_level(v: str) -> bool:\n    return LogLevel.from_string(v.strip()) is not None","tryCatchPattern":"except EnvironmentVarValueError:\n    level = LogLevel.INFO  # fallback","preventionTips":["Normalize log level strings at deploy time (map trace->debug, warn->warning)","Lowercase + strip env values before use"],"tags":["environment","logging","validation","config"],"backgroundTag":"env-var-validation","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}