Files
hermes-config/skills/software-development/immich-server/references/chrome-download-diagnostics.md
T
2026-07-12 10:17:17 -04:00

77 lines
2.4 KiB
Markdown

# Chrome Download Diagnostics
When Chrome downloads stall or get cancelled, the browser stores detailed state in a SQLite database. This is useful for diagnosing why downloads failed (e.g. Safe Browsing, network issues, etc.).
## Chrome's Download History DB
**Location:** `~/.config/google-chrome/Default/History`
For a Docker/Kasm container:
```bash
docker cp <container>:~/.config/google-chrome/Default/History /tmp/chrome_history.db
```
## Key Queries
### All recent downloads with state + reason codes
```python
import sqlite3
conn = sqlite3.connect('/tmp/chrome_history.db')
cur = conn.cursor()
state_map = {
0: 'IN_PROGRESS', 1: 'COMPLETE', 2: 'CANCELLED',
3: 'INTERRUPTED', 4: 'INTERRUPTED_AUTO_RESUME'
}
reason_map = {
0: 'No interrupt', 40: 'FILE_SECURITY_CHECK_FAILED',
50: 'NETWORK_FAILED', 51: 'NETWORK_TIMEOUT',
52: 'NETWORK_DISCONNECTED', 58: 'SERVER_UNAUTHORIZED',
70: 'USER_CANCELED', 71: 'USER_SHUTDOWN', 80: 'CRASH'
}
danger_map = {
0: 'SAFE', 4: 'UNCOMMON', 1: 'DANGEROUS', 2: 'DANGEROUS_URL'
}
cur.execute('''
SELECT id, target_path, state, interrupt_reason,
total_bytes, received_bytes, danger_type, end_time
FROM downloads ORDER BY id DESC LIMIT 15
''')
for r in cur.fetchall():
sid, path, state, reason, total, recv, danger, et = r
s = state_map.get(state, f'UNK({state})')
name = path.split('/')[-1] if path else '(no path)'
total_gb = f'{total//1024//1024} MB' if total else '?'
print(f'ID {sid}: {name}{s} ({total_gb})')
```
### Check for in-progress downloads
```sql
SELECT * FROM downloads WHERE state=0
```
## Common Error Patterns
| Scenario | State | Reason Code | Danger |
|----------|-------|-------------|--------|
| Large file killed by Safe Browsing | CANCELLED (2) | 40 (FILE_SECURITY_CHECK_FAILED) | 4 (UNCOMMON) |
| Network dropped mid-download | INTERRUPTED (3) | 52 (NETWORK_DISCONNECTED) | 0 |
| User cancelled | CANCELLED (2) | 70 (USER_CANCELED) | 0 |
| Chrome crash | INTERRUPTED (3) | 80 (CRASH) | 0 |
## Chrome Managed Policies (Linux)
Policies live in `/etc/opt/chrome/policies/managed/` for system-wide or under the user's profile. Multiple JSON files are merged automatically.
**To disable download scanning:**
```json
{
"DownloadRestrictions": 0,
"SafeBrowsingEnabled": false,
"SafeBrowsingProtectionForDownloadEnabled": false
}
```
After writing the policy file, restart Chrome: `pkill -f chrome` (the Kasm container will auto-restart it).