# pydantic.errors.PydanticUserError: A non-annotated attribute was detected: `children = []`. All model fields require a type annotation; if `children` is not meant to be a field, you may be able to resolve this error by annotating it as a `ClassVar` or updating `model_config['ignored_types']`.

- **ID:** `python/pydantic-recursion-loop-model`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A class-level assignment without a type annotation is treated as a field in Pydantic v2, even if it was intended as a constant or helper.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Annotate as ClassVar: `from typing import ClassVar
children: ClassVar[list] = []`
   ```
2. **** (92% success)
   ```
   Add a type annotation: `children: list[Node] = []` if it really is a field (use `Field(default_factory=list)`).
   ```

## Dead Ends

- **** — Setting the attribute inside `__init__` instead of at class level changes semantics and breaks serialization. (60% fail)
- **** — Adding `ClassVar` but keeping the mutable default still shares state across instances. (40% fail)
