apache/shardingsphere · warning · FirebirdProtocolException

Unknown database information request type %d

Error message

Unknown database information request type %d

What it means

Thrown when a Firebird SQL information request asks for an item other than RECORDS. Note the message text says 'database information request type' but the code actually parses FirebirdSQLInfoPacketType — a copy-paste message; the failing request is a statement/SQL info item. parseSQLInfo only implements RECORDS (row counts), so any other SQL info item throws.

Source

Thrown at database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/sql/FirebirdSQLInfoReturnPacket.java:71

    @Override
    protected void write(final FirebirdPacketPayload payload) {
        for (FirebirdInfoPacketType type : infoItems) {
            if (type.isCommon()) {
                FirebirdCommonInfoPacketType.parseCommonInfo(payload, (FirebirdCommonInfoPacketType) type);
            } else {
                parseSQLInfo(payload, (FirebirdSQLInfoPacketType) type);
            }
        }
    }
    
    private void parseSQLInfo(final FirebirdPacketPayload payload, final FirebirdSQLInfoPacketType type) {
        // TODO implement other request types handle
        switch (type) {
            case RECORDS:
                processRecords(payload);
                return;
            default:
                throw new FirebirdProtocolException("Unknown database information request type %d", type.getCode());
        }
    }
    
    private void processRecords(final FirebirdPacketPayload payload) {
        payload.writeInt1(FirebirdSQLInfoPacketType.RECORDS.getCode());
        payload.writeInt2LE(RECORDS_CLUSTER_LENGTH);
        writeCount(payload, REQ_SELECT_COUNT, 0L);
        writeCount(payload, REQ_INSERT_COUNT, recordsInfo.getInsertCount());
        writeCount(payload, REQ_UPDATE_COUNT, recordsInfo.getUpdateCount());
        writeCount(payload, REQ_DELETE_COUNT, recordsInfo.getDeleteCount());
    }
    
    private void writeCount(final FirebirdPacketPayload payload, final int countType, final long count) {
        payload.writeInt1(countType);
        payload.writeInt2LE(COUNT_VALUE_LENGTH);
        payload.writeInt4LE((int) count);
    }
}

View on GitHub (pinned to e952770a21)

Solutions

  1. Read the message as 'SQL info request type' despite the wording — inspect FirebirdSQLInfoReturnPacket, not the database-info packet
  2. Map the numeric item code to its isc_info_sql_* constant to identify the unsupported request
  3. Restrict client calls to the RECORDS info item (insert/update/delete/select counts)
  4. Implement the needed isc_info_sql_* case in parseSQLInfo and contribute it upstream
Defensive patterns

Strategy: validation

Validate before calling

// only ask for RECORDS via SQL info; gate other isc_info_sql_* items
if (item == FirebirdSQLInfoPacketType.RECORDS.getCode()) {
    statement.executeInfo(item);
} else {
    skip("SQL info item not implemented: " + item);
}

Type guard

static boolean isImplementedSqlInfoItem(final int code) {
    return code == FirebirdSQLInfoPacketType.RECORDS.getCode();
}

Try / catch

try {
    returnPacket.write(payload);
} catch (FirebirdProtocolException ex) {
    // despite the 'database' wording this is SQL info; log the item code and skip
    log.warn("SQL info item unsupported: {}", ex.getMessage());
}

Prevention

When it happens

Trigger: Issuing isc_dsql_sql_info with items such as isc_info_sql_stmt_type, isc_info_sql_get_plan, or isc_info_sql_batch_info — anything except the RECORDS item handled in FirebirdSQLInfoReturnPacket.parseSQLInfo().

Common situations: Drivers that ask for statement type or execution plan metadata after preparing SQL; ORMs doing feature detection; tools like DBeaver/flamerobin requesting plans. The misleading 'database' wording sends people to the wrong class.

Related errors


AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14). Data as JSON: /api/errors/344ba739ca82b6d4. Report an issue: GitHub.