{"record":{"id":"03533e2ff0e44594","repo":"appsmithorg/appsmith","slug":"pe-plg-5002","errorCode":"PE-PLG-5002","errorMessage":"Failed to connect to the in memory database. Unable to perform filtering : {}","messagePattern":"Failed to connect to the in memory database\\. Unable to perform filtering : (.+?)","errorType":"error_code","errorClass":"AppsmithPluginException","httpStatus":500,"severity":"critical","filePath":"app/server/appsmith-interfaces/src/main/java/com/appsmith/external/services/ce/FilterDataServiceCE.java","lineNumber":114,"sourceCode":"                            DataType.LONG,\n                            DataType.FLOAT,\n                            DataType.DOUBLE,\n                            DataType.BOOLEAN,\n                            DataType.DATE,\n                            DataType.TIME,\n                            DataType.TIMESTAMP),\n            DataType.DATE, Set.of(),\n            DataType.TIMESTAMP, Set.of());\n\n    public FilterDataServiceCE() {\n\n        objectMapper = SerializationUtils.getObjectMapperWithSourceInLocationEnabled();\n\n        try {\n            connection = DriverManager.getConnection(URL);\n        } catch (SQLException e) {\n            log.error(e.getMessage());\n            throw new AppsmithPluginException(\n                    AppsmithPluginError.PLUGIN_IN_MEMORY_FILTERING_ERROR,\n                    \"Failed to connect to the in memory database. Unable to perform filtering : \" + e.getMessage());\n        }\n    }\n\n    /**\n     * This filter method is using the new UQI format.\n     *\n     * @param items               - data\n     * @param uqiDataFilterParams - filter conditions to apply on data\n     * @return filtered data\n     */\n    public ArrayNode filterDataNew(ArrayNode items, UQIDataFilterParams uqiDataFilterParams) {\n        return this.filterDataNew(items, uqiDataFilterParams, null);\n    }\n\n    public ArrayNode filterDataNew(\n            ArrayNode items, UQIDataFilterParams uqiDataFilterParams, Map<DataType, DataType> dataTypeConversionMap) {","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/appsmithorg/appsmith/blob/8cd9021c24cdbea1c3c12c966073708e83db60c2/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/services/ce/FilterDataServiceCE.java#L96-L132","documentation":"Thrown by the FilterDataServiceCE constructor when DriverManager.getConnection('jdbc:h2:mem:filterDb;DATABASE_TO_UPPER=FALSE') raises SQLException. FilterDataServiceCE is the in-memory H2 engine used to filter/sort query results client-side; if the H2 driver cannot establish the in-memory connection at construction time, every subsequent filter operation is impossible, so the constructor aborts with PLUGIN_IN_MEMORY_FILTERING_ERROR.","triggerScenarios":"H2 JDBC driver missing from the classpath, the JVM out of memory (the in-memory DB cannot allocate), an H2 version conflict where the URL format is rejected, file-system / tmp issues for H2 shadow files, or another classloader already holding an incompatible H2 instance.","commonSituations":"Running Appsmith in a container where the H2 dependency was shaded out; OOM conditions under heavy load; a custom Appsmith build that excludes the h2 dependency; JDK upgrade that breaks the bundled H2 driver.","solutions":["Confirm the H2 dependency is on the classpath (com.h2database:h2) and matches the version Appsmith expects.","Check server memory - restart the JVM with a larger heap if OOM preceded the failure.","Inspect the chained SQLException message (it is appended to the error) for the precise H2 failure code.","If running a custom build, ensure no dependency shading strips the H2 driver META-INF/services entry."],"exampleFix":"// before\ntry {\n    connection = DriverManager.getConnection(URL);\n} catch (SQLException e) {\n    log.error(e.getMessage());\n    throw new AppsmithPluginException(\n        AppsmithPluginError.PLUGIN_IN_MEMORY_FILTERING_ERROR,\n        \"Failed to connect to the in memory database. Unable to perform filtering : \" + e.getMessage());\n}\n\n// after - log full stack and chain the cause\n} catch (SQLException e) {\n    log.error(\"H2 in-memory connection failed for URL {}\", URL, e);\n    throw new AppsmithPluginException(\n        AppsmithPluginError.PLUGIN_IN_MEMORY_FILTERING_ERROR,\n        \"Failed to connect to the in memory database: \" + e.getMessage(), e);\n}","handlingStrategy":"try-catch","validationCode":"// Validate the H2 driver is loadable before constructing FilterDataServiceCE\ntry {\n    Class.forName(\"org.h2.Driver\");\n} catch (ClassNotFoundException e) {\n    throw new IllegalStateException(\"H2 JDBC driver missing from classpath; filtering will be unavailable\", e);\n}\n// also verify memory headroom\nif (Runtime.getRuntime().freeMemory() < 16L * 1024 * 1024) {\n    throw new IllegalStateException(\"Insufficient heap for in-memory H2 filter DB\");\n}","typeGuard":"public static boolean h2DriverAvailable() {\n    try {\n        Class.forName(\"org.h2.Driver\");\n        return true;\n    } catch (ClassNotFoundException e) {\n        return false;\n    }\n}","tryCatchPattern":"FilterDataServiceCE service;\ntry {\n    service = new FilterDataServiceCE();\n} catch (AppsmithPluginException e) {\n    log.error(\"In-memory filter DB unavailable, filtering disabled\", e);\n    // degrade gracefully: return unfiltered results\n    service = null;\n}","preventionTips":["Pin the H2 dependency version Appsmith expects.","Monitor JVM heap; restart under OOM conditions.","Ensure dependency shading does not strip H2's META-INF/services entry."],"tags":["h2","in-memory-db","filtering","startup","datasource","infrastructure"],"backgroundTag":null,"analyzedSha":"8cd9021c24cdbea1c3c12c966073708e83db60c2","analyzedAt":"2026-08-12T22:14:19.293Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}