flowable/flowable-engine · error · FlowableException

couldn't get table counts

Error message

couldn't get table counts

What it means

Flowable wraps any failure while counting rows in its database tables into this FlowableException. getTableCount() iterates all tables present in the database and counts rows per table; if any per-table count query (or listing the tables) fails, the original exception is rethrown with this message.

Source

Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/persistence/entity/TableDataManagerImpl.java:59

    private static final Logger LOGGER = LoggerFactory.getLogger(TableDataManagerImpl.class);
    
    protected AbstractEngineConfiguration engineConfiguration;
    
    public TableDataManagerImpl(AbstractEngineConfiguration engineConfiguration) {
        this.engineConfiguration = engineConfiguration;
    }

    @Override
    public Map<String, Long> getTableCount() {
        Map<String, Long> tableCount = new HashMap<>();
        try {
            for (String tableName : getTablesPresentInDatabase()) {
                tableCount.put(tableName, getTableCount(tableName));
            }
            LOGGER.debug("Number of rows per flowable table: {}", tableCount);
        } catch (Exception e) {
            throw new FlowableException("couldn't get table counts", e);
        }
        return tableCount;
    }

    @Override
    public List<String> getTablesPresentInDatabase() {
        List<String> tableNames = new ArrayList<>();
        try {
            Connection connection = getDbSqlSession().getSqlSession().getConnection();
            DatabaseMetaData databaseMetaData = connection.getMetaData();
            LOGGER.debug("retrieving flowable tables from jdbc metadata");
            String databaseTablePrefix = getDbSqlSession().getDbSqlSessionFactory().getDatabaseTablePrefix();
            String actTableNameFilter = getTableNameFilter(databaseMetaData, databaseTablePrefix, "ACT");
            String flwTableNameFilter = getTableNameFilter(databaseMetaData, databaseTablePrefix, "FLW");

            String catalog = getDatabaseCatalog();

            String schema = getDatabaseSchema();

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Check the wrapped cause exception for the root SQL error (connection, permission, or missing table)
  2. Grant the DB user SELECT privileges on all Flowable ACT_/FLW_ tables
  3. Verify database connectivity and that the engine schema exists (run databaseSchemaUpdate or the schema scripts)
  4. Confirm the configured databaseType matches the actual database

Example fix

// before
long count = managementService.getTableCount();
// after
try {
    long count = managementService.getTableCount();
} catch (FlowableException e) {
    LOGGER.error("table count failed; cause=" + e.getCause(), e);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure connectivity & permissions first
try (Connection c = dataSource.getConnection()) {
    DatabaseMetaData md = c.getMetaData();
    ResultSet rs = md.getTables(null, schema, "ACT_RU_TASK", null);
    if (!rs.next()) throw new IllegalStateException("Flowable schema missing");
}

Try / catch

try {
    long count = managementService.getTableCount();
} catch (FlowableException e) {
    LOGGER.error("Table count failed: {}", e.getCause() != null ? e.getCause().getMessage() : e.getMessage(), e);
}

Prevention

When it happens

Trigger: Calling ManagementService.getTableCount() (directly or via engine startup schema checks) when the underlying table count SQL fails: table dropped mid-check, insufficient SELECT privileges, broken connection, or getTablesPresentInDatabase() failing.

Common situations: Database user lacks SELECT permission on Flowable tables; database connection lost or timed out during engine initialization; schema partially dropped/corrupted; unsupported database dialect producing bad metadata queries.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/af28177ebb0a4a78. Report an issue: GitHub.