apache/shardingsphere · error · FirebirdProtocolException

Unknown statement info request type %d

Error message

Unknown statement info request type %d

What it means

FirebirdProtocolException thrown by FirebirdPrepareStatementCommandExecutor while iterating the describe items requested in a prepare packet: an item type other than the supported describe-variants (describe output / describe bind, each optionally skipped) reaches the default branch. The proxy only knows how to describe the SELECT-list and the BIND parameters.

Source

Thrown at proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/prepare/FirebirdPrepareStatementCommandExecutor.java:165

                case STMT_TYPE:
                    returnPacket.setType(statementType);
                    break;
                case SELECT:
                    if (statementType.isSelectDescribable()) {
                        processDescribe(sqlStatementContext, metaDataContexts, returnPacket.getDescribeSelect(), true);
                    } else {
                        skipDescribe();
                    }
                    break;
                case BIND:
                    if (statementType.isBindDescribable()) {
                        processDescribe(sqlStatementContext, metaDataContexts, returnPacket.getDescribeBind(), false);
                    } else {
                        skipDescribe();
                    }
                    break;
                default:
                    throw new FirebirdProtocolException("Unknown statement info request type %d", packet.getCurrentItem());
            }
        }
        return Collections.singleton(new FirebirdGenericResponsePacket().setData(returnPacket));
    }
    
    private FirebirdSQLInfoReturnValue getFirebirdStatementType(final SQLStatement statement) {
        if (statement instanceof SelectStatement) {
            return FirebirdSQLInfoReturnValue.SELECT;
        }
        if (statement instanceof InsertStatement) {
            if (((InsertStatement) statement).getReturning().isPresent()) {
                returningSegment = ((InsertStatement) statement).getReturning().orElse(null);
                return FirebirdSQLInfoReturnValue.EXEC_PROCEDURE;
            }
            return FirebirdSQLInfoReturnValue.INSERT;
        }
        if (statement instanceof UpdateStatement) {
            if (((UpdateStatement) statement).getReturning().isPresent()) {

View on GitHub (pinned to e952770a21)

Solutions

  1. Request only describe-output and describe-bind items in the prepare message (as Jaybird does by default).
  2. Disable client options that ask for extended statement info (e.g. plan retrieval) when connecting through the proxy.
  3. Check item-list encoding (item type followed by item length) if you build prepare packets manually.
Defensive patterns

Strategy: try-catch

Try / catch

catch (SQLException e) {
    if (e.getMessage().contains("Unknown statement info request type")) {
        // simplify the prepare request: ask only for describe output + describe bind
        sendPrepareMinimal(sql);
    } else throw e;
}

Prevention

When it happens

Trigger: The executor loops over the requested info items in the PREPARE message; the switch handles item types whose statementType is describable (e.g. DESCRIBE for output, BIND for input) and skips otherwise; packet.getCurrentItem() outside those constants throws 'Unknown statement info request type %d'.

Common situations: a client requesting extended statement info items (e.g. statement plan or metadata extensions) the proxy does not implement; malformed item list where a length byte is misread as an item type; client from a newer Firebird protocol asking for new describe items.

Related errors


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