SQLITE_CANTOPEN_ISDIR
SQLiteERRORNotableFile Accessofficial confidence
Cannot open — path is a directory
Production Risk
Low — fails immediately and obviously at startup.
What this means
SQLITE_CANTOPEN_ISDIR (1038) is returned when sqlite3_open() is called with a path that points to a directory rather than a file.
Why it happens
- 1Passing a directory path instead of a file path to sqlite3_open().
- 2Path ends with "/" without specifying a filename.
How to reproduce
sqlite3_open() or sqlite3.connect() with a directory path.
trigger — this will error
trigger — this will error
import sqlite3
try:
conn = sqlite3.connect('/tmp/')
except sqlite3.OperationalError as e:
print(e) # unable to open database fileexpected output
sqlite3.OperationalError: unable to open database file
Fix 1
Fix 2
Sources
Official documentation ↗
sqlite3.h — SQLITE_CANTOPEN_ISDIR = 1038
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev