Tencent/matrix · error · IllegalStateException
getIssueStorage db not ready
Error message
getIssueStorage db not ready
What it means
SQLiteLintDbHelper.getDatabase returns the wrapped internal database, but the helper (mHelper) is initialized asynchronously/optionally. If getDatabase is called before init completes (mHelper == null), it throws IllegalStateException('getIssueStorage db not ready') instead of returning a half-initialized database.
Solutions
- Ensure SQLiteLint (Matrix plugin) is fully initialized before touching issue persistence; gate access on the init callback.
- Call getDatabase only from the main flow after SQLiteLint's startup work completes.
- Check init logs for earlier failures that prevented mHelper assignment.
- If the API is invoked from another process, use the IPC/exported path instead of direct db access.
Example fix
// before
SQLiteLint issue storage accessed in Application.onCreate before Matrix.init finishes
// after
Matrix.init(config, new MatrixInitListener() {
@Override public void onInitFinish() {
// now safe to use sqlite-lint issue storage
}
}); Defensive patterns
Strategy: try-catch
Validate before calling
// only access after Matrix/SQLiteLint init callback fired
if (!matrixInitialized) { deferUntilOnInitFinish(() -> useIssueStorage()); } Try / catch
try {
db = dbHelper.getDatabase();
} catch (IllegalStateException e) {
// db not ready: retry after init callback or re-init plugin
} Prevention
- Gate all sqlite-lint persistence access behind the Matrix init callback
- Avoid cross-process direct db access; use IPC paths
- Check init logs for silent init failures
When it happens
Trigger: Calling getDatabase (e.g. via issue storage during behaviour/persistence of lint issues) before SQLiteLint's install/init has finished setting up the internal db helper, or after init failed silently.
Common situations: Querying/deleting issues immediately after plugin install without waiting for initialization callback; multi-process use where only one process initialized the db; init exception leaving mHelper permanently null.
Related errors
- OwnDbDirectory not init
- Closed during initialization
- getDatabase called recursively
- Matrix init, Matrix should not be null.
- you must init Matrix sdk first
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/b7711c006e6220bb.
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/SQLiteLintDbHelper.java:45
* but SQLiteLintOwnDatabase can determine the path of the db file
*
* @author liyongjie
* Created by liyongjie on 2017/6/22.
*/
public enum SQLiteLintDbHelper {
INSTANCE;
private static final String TAG = "SQLiteLint.SQLiteLintOwnDatabase";
private static final String DB_NAME = "SQLiteLintInternal.db";
private static final int VERSION_1 = 1;
private volatile InternalDbHelper mHelper;
public SQLiteDatabase getDatabase() {
if (mHelper == null) {
throw new IllegalStateException("getIssueStorage db not ready");
}
return mHelper.getWritableDatabase();
}
/**
* initialize in {@link com.tencent.sqlitelint.SQLiteLintAndroidCore}
* ensures initialized before all the SQLiteLint own db operations begins
*
* @param context
*/
public void initialize(Context context) {
if (mHelper == null) {
synchronized (this) {
if (mHelper == null) {
mHelper = new InternalDbHelper(context);
}
}View on GitHub (pinned to 3b8293bd65)