# pydantic_settings.exceptions.SettingsError: error parsing value for field "DATABASE_URL" from source "EnvSettingsSource"

- **ID:** `python/starlette-uvicorn-invalid-env`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A Pydantic BaseSettings field expects a URL/int/bool but the environment variable is malformed or empty.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (92% success)
   ```
   from pydantic import PostgresDsn
class Settings(BaseSettings):
    database_url: PostgresDsn
   ```
2. **** (95% success)
   ```
   export DATABASE_URL='postgresql://user:pass@localhost:5432/db'
   ```

## Dead Ends

- **** — Downstream code receives None and fails at connect time. (80% fail)
- **** — Silently connects to the wrong database. (85% fail)
