{"record":{"id":"b7711c006e6220bb","repo":"Tencent/matrix","slug":"getissuestorage-db-not-ready","errorCode":null,"errorMessage":"getIssueStorage db not ready","messagePattern":"getIssueStorage db not ready","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/SQLiteLintDbHelper.java","lineNumber":45,"sourceCode":" * but SQLiteLintOwnDatabase can determine the path of the db file\n *\n * @author liyongjie\n *         Created by liyongjie on 2017/6/22.\n */\n\npublic enum SQLiteLintDbHelper {\n    INSTANCE;\n\n    private static final String TAG = \"SQLiteLint.SQLiteLintOwnDatabase\";\n\n    private static final String DB_NAME = \"SQLiteLintInternal.db\";\n    private static final int VERSION_1 = 1;\n\n    private volatile InternalDbHelper mHelper;\n\n    public SQLiteDatabase getDatabase() {\n        if (mHelper == null) {\n            throw new IllegalStateException(\"getIssueStorage db not ready\");\n        }\n\n        return mHelper.getWritableDatabase();\n    }\n\n    /**\n     * initialize in {@link com.tencent.sqlitelint.SQLiteLintAndroidCore}\n     * ensures initialized before all the SQLiteLint own db operations begins\n     *\n     * @param context\n     */\n    public void initialize(Context context) {\n        if (mHelper == null) {\n            synchronized (this) {\n                if (mHelper == null) {\n                    mHelper = new InternalDbHelper(context);\n                }\n            }","sourceCodeStart":27,"sourceCodeEnd":63,"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/SQLiteLintDbHelper.java#L27-L63","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nSQLiteLint issue storage accessed in Application.onCreate before Matrix.init finishes\n// after\nMatrix.init(config, new MatrixInitListener() {\n    @Override public void onInitFinish() {\n        // now safe to use sqlite-lint issue storage\n    }\n});","handlingStrategy":"try-catch","validationCode":"// only access after Matrix/SQLiteLint init callback fired\nif (!matrixInitialized) { deferUntilOnInitFinish(() -> useIssueStorage()); }","typeGuard":null,"tryCatchPattern":"try {\n    db = dbHelper.getDatabase();\n} catch (IllegalStateException e) {\n    // db not ready: retry after init callback or re-init plugin\n}","preventionTips":["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"],"tags":["sqlite","initialization","illegal-state","database"],"backgroundTag":"module-init-failed","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"}