# pydantic_core._pydantic_core.ValidationError: 1 validation error for Settings
api_key
  Instance is frozen [type=frozen_instance, input_value='new-key', input_type=str]

- **ID:** `python/pydantic-configerror-frozen-field-mutation`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A BaseSettings/BaseModel was declared with model_config = ConfigDict(frozen=True), and code attempted to assign a new value to a field after construction.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   new_settings = settings.model_copy(update={'api_key': 'new-key'})
   ```
2. **** (90% success)
   ```
   class Settings(BaseSettings):
    model_config = ConfigDict(frozen=False)
    api_key: str
   ```

## Dead Ends

- **** — Bypassing Pydantic's __setattr__ works at runtime but leaves the model's internal __pydantic_fields_set__ inconsistent and can break serialization. (55% fail)
- **** — frozen models also block __delattr__, raising TypeError: cannot delete field. (90% fail)
