# Open WebUI SQLAlchemy `fromisoformat` Crash

**Symptom:** Open WebUI fails to start with:
```
TypeError: fromisoformat: argument must be str
  ...
  File "lib/sqlalchemy/cyextension/processors.pyx", line 40, in
  sqlalchemy.cyextension.processors.str_to_datetime
TypeError: fromisoformat: argument must be str
```

The container enters a restart loop (`Restarting (1) N seconds ago`).

**Root cause:** The `config` table's `updated_at` column contains an **integer** (Unix timestamp like `1782594088`) instead of a **string** (`YYYY-MM-DD HH:MM:SS`). SQLAlchemy's `str_to_datetime` processor calls `.fromisoformat()` on the value, which fails on integers.

This can happen when:
- An older version of Open WebUI wrote a Unix timestamp, then an upgrade switched to datetime strings
- A DB tool or migration script inserted an integer directly
- A Docker volume was migrated from a different OWU version

## Fix

```python
import sqlite3, datetime

db = "/path/to/webui.db"  # e.g. /home/rurouni/openwebui-data/webui.db
conn = sqlite3.connect(db)

row = conn.execute("SELECT id, updated_at FROM config").fetchone()
if isinstance(row[1], int):
    dt_str = datetime.datetime.fromtimestamp(row[1]).strftime("%Y-%m-%d %H:%M:%S")
    conn.execute("UPDATE config SET updated_at = ? WHERE id = ?", (dt_str, row[0]))
    conn.commit()
    print(f"Fixed: updated_at was int ({row[1]}), now {dt_str}")
```

Then restart the container: `docker start open-webui`

## Verify

The container should start cleanly. Check logs for the `fromisoformat` error:
```bash
docker logs open-webui --tail 5 2>&1 | grep -i error
```

## Prevention

None — this is a pre-existing data corruption, not a recurring bug. Once fixed it stays fixed. 

## Related

- The `config` table has 5 columns: `id` (INTEGER), `data` (JSON), `version` (INTEGER), `created_at` (DATETIME), `updated_at` (DATETIME)
- The `data` column stores the entire OWU configuration as a JSON blob, including model lists and API configs
- When fixing model list drift in OWU, both the `model` table (per-user registry) and the `data` blob's `openai.api_configs.0.model_ids` and `openai.model_ids` arrays must be updated
