pgref.dev/sqlite/errors/SQLITE_READONLY_DIRECTORY
SQLITE_READONLY_DIRECTORYERRORTier 2 — Caution⚠️ MEDIUM confidence

Read-only: journal directory is not writable

Category: Read-OnlyVersions: 3.33.0+

🔴 Production Risk Error

High — all writes fail; journal files cannot be created.

What this means

SQLITE_READONLY_DIRECTORY (1544) is returned when the database file itself is writable but the directory containing it is not, preventing creation of the journal or WAL sidecar files.

Why it happens

  1. 1Database file is writable but the parent directory is not (e.g., group permissions missing on directory).
  2. 2Docker volume: file permissions differ from directory permissions.

How to reproduce

First write to a database where the directory is not writable.

trigger — this will ERROR
import os, sqlite3
os.chmod('/data/', 0o555)  # directory read/execute only
conn = sqlite3.connect('/data/my.db')
try:
    conn.execute('CREATE TABLE t(x)')
except sqlite3.OperationalError as e:
    print(e)  # attempt to write a readonly database
sqlite3.OperationalError: attempt to write a readonly database

Fix 1

Why this works

Make the parent directory writable: chmod 775 /data/

Fix 2

Why this works

Ensure the application user has write permission to the directory, not just the file.

Version notes

Sources

📚 Official docs: https://www.sqlite.org/rescode.html#readonly_directory

🔧 Source ref: sqlite3.h — SQLITE_READONLY_DIRECTORY = 1544

Confidence assessment

⚠️ MEDIUM confidence

Stable.

See also

⚙️ This error reference was generated with AI assistance and reviewed for accuracy. Examples are provided to illustrate common scenarios and may not cover every case. Always test fixes in a development environment before applying to production. Spotted an error? Suggest a correction →