# AttributeError: 'LogCaptureFixture' object has no attribute 'records'

- **ID:** `python/pytest-capture-caplog-attribute-error`
- **Domain:** python
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Using an outdated or incorrect API for caplog; 'records' was introduced in pytest 6.x but may not be available in older versions or when caplog is not properly initialized.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |

## Workarounds

1. **Upgrade pytest to version 6.0 or later to support caplog.records.** (95% success)
   ```
   pip install pytest>=6.0
   ```
2. **Use caplog.record_tuples instead of caplog.records for backward compatibility.** (85% success)
   ```
   assert ('module', logging.INFO, 'message') in caplog.record_tuples
   ```

## Dead Ends

- **Trying to access caplog.records without checking pytest version** — If pytest version is below 6.0, 'records' attribute doesn't exist. (70% fail)
- **Using caplog.text instead of caplog.records for log level checks** — caplog.text returns a string, not log records, so level filtering fails. (65% fail)
