Tencent/matrix · error · IllegalStateException
OwnDbDirectory not init
Error message
OwnDbDirectory not init
What it means
Before opening/creating its private database, SQLiteLintOwnDatabase.openOrCreateDatabase checks that the static sOwnDbDirectory has been set via the init API. If it is null or empty it throws IllegalStateException('OwnDbDirectory not init'), because the library refuses to guess where to store its db file.
Solutions
- Call the SQLiteLintOwnDatabase directory init API (setting sOwnDbDirectory) with a valid writable path before using the database.
- Verify your Matrix/SQLiteLint builder supplies the storage directory configuration.
- Ensure the configured path is non-empty and the app has write permission to it.
- If integrating manually, replicate the init order used by the SDK's default installer.
Example fix
// before
SQLiteDatabase db = ownDatabase.getDatabase(); // directory never set
// after
SQLiteLintOwnDatabase.init("/data/data/<pkg>/databases/sqlitelint");
SQLiteDatabase db = ownDatabase.getDatabase(); Defensive patterns
Strategy: validation
Validate before calling
if (SQLiteLintOwnDatabase not initialized with a directory) {
initOwnDatabaseDirectory(context.getDatabasePath("sqlitelint").getParent());
} Try / catch
try {
db = ownDatabase.getDatabase();
} catch (IllegalStateException e) {
// directory missing: run init with a valid path, then retry
} Prevention
- Call the directory init API before any database use
- Supply a non-empty writable path in the SQLiteLint builder
- Keep init order identical to the SDK's default installer
When it happens
Trigger: Calling getDatabase (which invokes openOrCreateDatabase) before SQLiteLintOwnDatabase's directory-init method was called with a valid storage path — e.g. using the lint persistence layer before Matrix/SQLiteLint configuration supplied the directory.
Common situations: Custom integration skipping the SQLiteLint builder configuration step; init code path executed on a process/process-flavor where directory setup was never run; passing an empty string as the directory during init.
Understand the failure class
Background: "missing required config value" errors: why libraries refuse to start when a configuration key is empty, unset, or blank — this error's family across 48 libraries.
Related errors
- getIssueStorage db not ready
- getDatabase called recursively
- Matrix init, Matrix should not be null.
- you must init Matrix sdk first
- matrix init, application is null
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/c697ec33521488cd.
Report an issue: GitHub.
Appendix: source
Thrown at matrix/matrix-android/matrix-sqlite-lint/matrix-sqlite-lint-android-sdk/src/full/java/com/tencent/sqlitelint/behaviour/persistence/SQLiteLintOwnDatabase.java:115
db.execSQL(IssueStorage.DB_VERSION_1_CREATE_SQL);
for (int i = 0; i < IssueStorage.DB_VERSION_1_CREATE_INDEX.length; i++) {
db.execSQL(IssueStorage.DB_VERSION_1_CREATE_INDEX[i]);
}
}
private void onUpgrade(SQLiteDatabase db, int oldVersion) {
SLog.i(TAG, "onUpgrade oldVersion=%d, newVersion=%d", oldVersion, NEW_VERSION);
}
/* only called in getDatabase synchronize block */
private SQLiteDatabase openOrCreateDatabase() {
if (mIsInitializing) {
throw new IllegalStateException("getDatabase called recursively");
}
if (SQLiteLintUtil.isNullOrNil(sOwnDbDirectory)) {
throw new IllegalStateException("OwnDbDirectory not init");
}
try {
mIsInitializing = true;
String databasePath = String.format("%s/%s", sOwnDbDirectory, DATABASE_NAME);
SLog.i(TAG, "openOrCreateDatabase path=%s", databasePath);
SQLiteLintUtil.mkdirs(databasePath);
SQLiteDatabase db = SQLiteDatabase.openDatabase(databasePath, null, SQLiteDatabase.CREATE_IF_NECESSARY, null);
final int version = db.getVersion();
if (version != NEW_VERSION) {
db.beginTransaction();
try {
if (version == 0) {
onCreate(db);
} else {
if (version != NEW_VERSION) {
onUpgrade(db, version);View on GitHub (pinned to 3b8293bd65)