{"record":{"id":"c697ec33521488cd","repo":"Tencent/matrix","slug":"owndbdirectory-not-init","errorCode":null,"errorMessage":"OwnDbDirectory not init","messagePattern":"OwnDbDirectory not init","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-sqlite-lint/matrix-sqlite-lint-android-sdk/src/full/java/com/tencent/sqlitelint/behaviour/persistence/SQLiteLintOwnDatabase.java","lineNumber":115,"sourceCode":"\n        db.execSQL(IssueStorage.DB_VERSION_1_CREATE_SQL);\n        for (int i = 0; i < IssueStorage.DB_VERSION_1_CREATE_INDEX.length; i++) {\n            db.execSQL(IssueStorage.DB_VERSION_1_CREATE_INDEX[i]);\n        }\n    }\n\n    private void onUpgrade(SQLiteDatabase db, int oldVersion) {\n        SLog.i(TAG, \"onUpgrade oldVersion=%d, newVersion=%d\", oldVersion, NEW_VERSION);\n    }\n\n    /* only called in getDatabase synchronize block */\n    private SQLiteDatabase openOrCreateDatabase() {\n        if (mIsInitializing) {\n            throw new IllegalStateException(\"getDatabase called recursively\");\n        }\n\n        if (SQLiteLintUtil.isNullOrNil(sOwnDbDirectory)) {\n            throw new IllegalStateException(\"OwnDbDirectory not init\");\n        }\n\n        try {\n            mIsInitializing = true;\n\n            String databasePath = String.format(\"%s/%s\", sOwnDbDirectory, DATABASE_NAME);\n            SLog.i(TAG, \"openOrCreateDatabase path=%s\", databasePath);\n            SQLiteLintUtil.mkdirs(databasePath);\n            SQLiteDatabase db = SQLiteDatabase.openDatabase(databasePath, null, SQLiteDatabase.CREATE_IF_NECESSARY, null);\n            final int version = db.getVersion();\n            if (version != NEW_VERSION) {\n                db.beginTransaction();\n                try {\n                    if (version == 0) {\n                        onCreate(db);\n                    } else {\n                        if (version != NEW_VERSION) {\n                            onUpgrade(db, version);","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-sqlite-lint/matrix-sqlite-lint-android-sdk/src/full/java/com/tencent/sqlitelint/behaviour/persistence/SQLiteLintOwnDatabase.java#L97-L133","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nSQLiteDatabase db = ownDatabase.getDatabase(); // directory never set\n// after\nSQLiteLintOwnDatabase.init(\"/data/data/<pkg>/databases/sqlitelint\");\nSQLiteDatabase db = ownDatabase.getDatabase();","handlingStrategy":"validation","validationCode":"if (SQLiteLintOwnDatabase not initialized with a directory) {\n    initOwnDatabaseDirectory(context.getDatabasePath(\"sqlitelint\").getParent());\n}","typeGuard":null,"tryCatchPattern":"try {\n    db = ownDatabase.getDatabase();\n} catch (IllegalStateException e) {\n    // directory missing: run init with a valid path, then retry\n}","preventionTips":["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"],"tags":["sqlite","initialization","configuration","database"],"backgroundTag":"missing-config-value","analyzedSha":"3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7","analyzedAt":"2026-09-08T08:01:39.722Z","contentChangedAt":"2026-09-08T08:01:39.722Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}