# pydantic_core._pydantic_core.ValidationError: 1 validation error for Settings
database_url
  Field required [type=missing, input_value={}, input_type=dict]

- **ID:** `python/pydantic-settings-env-not-loaded`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

pydantic-settings reads env vars at instantiation; the variable name case or prefix doesn't match, or .env file isn't loaded.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
    model_config = SettingsConfigDict(env_file='.env', case_sensitive=False)
    database_url: str
   ```
2. **** (90% success)
   ```
   export DATABASE_URL=postgres://...
python -c 'import os; print(os.environ.get("DATABASE_URL"))'
   ```

## Dead Ends

- **** — Still requires the var to be present in os.environ at import time. (45% fail)
- **** — Defeats the purpose of env-driven config; secrets end up in source. (60% fail)
- **** — Runs after field resolution; too late for required-field errors. (50% fail)
