Skip to content

Inform about opening session DB #142

@yarikoptic

Description

@yarikoptic

Originally in

Thanks for the detailed follow-up @yarikoptic, this clarifies everything. There are actually two separate issues here — let me break them down:

Issue 1: sqlite3.OperationalError: unable to open database file (the blocker)

This error is not about the app's SQLite DB (telegram_backup.db). Looking at your traceback:

File "/app/src/telegram_backup.py", line 242, in connect
    self.client = TelegramClient(
        self.config.session_path,
...
File "telethon/sessions/sqlite.py", line 48
sqlite3.OperationalError: unable to open database file

This is Telethon's session file (/data/session/onerussian.session) — the Telegram auth session, not the backup database.

And that summary was actually correct and the reason for this error to happen since in my case that file was under git-annex so read-only and required "unlocking" first.

It would be great if error message here was more explicit and listed the path to the database file in question since a newbee user sees only mentioning of the main, not session, DB in

2026-05-04 18:36:59 - src.db.base - INFO - Initializing database: sqlite+aiosqlite:///data/telegram_backup.db
2026-05-04 18:37:00 - src.db.base - INFO - Database initialized successfully (SQLite)
2026-05-04 18:37:00 - src.telegram_backup - INFO - TelegramBackup initialized
2026-05-04 18:37:00 - src.db.base - INFO - Database connections closed

so at least adding INFO level message like Opening session database: sqlite+.....session would be sufficient here to hint on what next is to fail

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions