[P6] Zotero annotation/highlight save errors prevent extraction #93

Closed
opened 2026-03-22 03:08:24 +00:00 by kert · 0 comments
Owner

Problem

Highlighting and extracting annotations from Zotero PDF attachments fails with errors when saving highlights.

Investigation Findings

1. Permissions: NOT the cause

File ownership is uid 100999 on host → maps to uid 1000 (ubuntu) in container via user namespace. Write tests pass for both storage dirs and db directory.

2. SQLite exclusive lock: NORMAL behavior

Zotero 8.0.2 opens the database with EXCLUSIVE locking mode (no SHM file). This is by design — the missing -shm file is expected. External mode=ro connections fail with "database is locked" — this is a side effect, not the root cause.

3. Database integrity: OK

WAL checkpointed successfully (9320 items). PRAGMA quick_check returns ok. itemAnnotations table exists with correct schema. 2 existing annotations confirm the feature has worked before.

4. D-Bus notifications: FAILING

org.freedesktop.Notifications service exits with status 1. This may cause Zotero save confirmations to fail silently.

5. Debug logging enabled

Added extensions.zotero.debug.log=true to prefs.js for next reproduction attempt.

Next Steps

  1. Get exact error message from Zotero UI (Help → Debug Output Logging → View Output, or Error Console)
  2. Fix D-Bus notifications — install notification daemon in Dockerfile or suppress the dependency
  3. Fix external reader access — use conf.connect.zotero() with ?immutable=1 instead of ?mode=ro to bypass exclusive lock
  4. Build annotation extraction query once saves work

External Reader Fix (conf/connect.py)

Change mode=ro to immutable=1 for reading while Zotero holds exclusive lock:

def zotero() -> sqlite3.Connection:
    db = path("db.zotero")
    return sqlite3.connect(f"file:{db}?immutable=1", uri=True)

Note: immutable mode reads only the main db file, not uncommitted WAL data. This is acceptable for bibliography queries.

## Problem Highlighting and extracting annotations from Zotero PDF attachments fails with errors when saving highlights. ## Investigation Findings ### 1. Permissions: NOT the cause File ownership is uid 100999 on host → maps to uid 1000 (ubuntu) in container via user namespace. Write tests pass for both storage dirs and db directory. ### 2. SQLite exclusive lock: NORMAL behavior Zotero 8.0.2 opens the database with `EXCLUSIVE` locking mode (no SHM file). This is by design — the missing `-shm` file is expected. External `mode=ro` connections fail with "database is locked" — this is a side effect, not the root cause. ### 3. Database integrity: OK WAL checkpointed successfully (9320 items). `PRAGMA quick_check` returns ok. `itemAnnotations` table exists with correct schema. 2 existing annotations confirm the feature has worked before. ### 4. D-Bus notifications: FAILING `org.freedesktop.Notifications` service exits with status 1. This may cause Zotero save confirmations to fail silently. ### 5. Debug logging enabled Added `extensions.zotero.debug.log=true` to prefs.js for next reproduction attempt. ## Next Steps 1. **Get exact error message** from Zotero UI (Help → Debug Output Logging → View Output, or Error Console) 2. **Fix D-Bus notifications** — install notification daemon in Dockerfile or suppress the dependency 3. **Fix external reader access** — use `conf.connect.zotero()` with `?immutable=1` instead of `?mode=ro` to bypass exclusive lock 4. **Build annotation extraction query** once saves work ## External Reader Fix (conf/connect.py) Change `mode=ro` to `immutable=1` for reading while Zotero holds exclusive lock: ```python def zotero() -> sqlite3.Connection: db = path("db.zotero") return sqlite3.connect(f"file:{db}?immutable=1", uri=True) ``` Note: immutable mode reads only the main db file, not uncommitted WAL data. This is acceptable for bibliography queries.
kert added this to the P9: CI/CD Unification milestone 2026-03-22 03:08:24 +00:00
kert added the auth label 2026-03-22 03:08:24 +00:00
kert closed this issue 2026-03-22 03:30:53 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: homelab/stack#93