{"record":{"id":"cf9d48eb9b34db3b","repo":"apache/shardingsphere","slug":"unknown-dsql-option-type-d","errorCode":null,"errorMessage":"Unknown DSQL option type %d","messagePattern":"Unknown DSQL option type (.+?)","errorType":"exception","errorClass":"FirebirdProtocolException","httpStatus":null,"severity":"error","filePath":"proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/free/FirebirdFreeStatementCommandExecutor.java","lineNumber":57,"sourceCode":"    \n    private final FirebirdFreeStatementPacket packet;\n    \n    private final ConnectionSession connectionSession;\n    \n    @Override\n    public Collection<DatabasePacket> execute() throws SQLException {\n        switch (packet.getOption()) {\n            case FirebirdFreeStatementPacket.DROP:\n            case FirebirdFreeStatementPacket.UNPREPARE:\n                connectionSession.getServerPreparedStatementRegistry().removePreparedStatement(packet.getStatementId());\n                FirebirdBatchRegistry.getInstance().unregisterBatchStatement(connectionSession.getConnectionId(), packet.getStatementId());\n                FirebirdStatementResourceCleaner.clean(connectionSession, packet.getStatementId(), true);\n                break;\n            case FirebirdFreeStatementPacket.CLOSE:\n                FirebirdStatementResourceCleaner.clean(connectionSession, packet.getStatementId(), false);\n                break;\n            default:\n                throw new FirebirdProtocolException(\"Unknown DSQL option type %d\", packet.getOption());\n        }\n        return Collections.singleton(new FirebirdGenericResponsePacket());\n    }\n}\n","sourceCodeStart":39,"sourceCodeEnd":62,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/free/FirebirdFreeStatementCommandExecutor.java#L39-L62","documentation":"FirebirdProtocolException thrown by FirebirdFreeStatementCommandExecutor when the option int in a FREE STATEMENT packet is not one of DROP, UNPREPARE, or CLOSE. Unknown option values mean the packet is malformed or the client uses a DSQL free option this proxy does not implement.","triggerScenarios":"switch (packet.getOption()) hits default; only FirebirdFreeStatementPacket.DROP, .UNPREPARE (both remove the prepared statement and unregister any batch) and .CLOSE (resource cleanup only) are accepted.","commonSituations":"hand-written clients sending a raw Firebird DSQL_free option bitmask that includes unhandled bits; newer client sending an option constant added after the proxy implementation; packet misalignment making a different field land in the option slot.","solutions":["Send only the DROP, UNPREPARE or CLOSE option constants exactly as the Firebird DSQL API defines them.","If the option is a bitmask in your client, mask to the single supported option rather than OR-ing flags.","Verify overall packet layout (option int position) against the Firebird wire protocol when hand-encoding."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"static final int DSQL_DROP = 2, DSQL_UNPREPARE = 4, DSQL_CLOSE = 1;\nif (!Set.of(DSQL_DROP, DSQL_UNPREPARE, DSQL_CLOSE).contains(option)) throw new IllegalArgumentException(\"bad free option\");\nsendFreeStatement(stmtHandle, option);","typeGuard":null,"tryCatchPattern":"catch (SQLException e) {\n    if (e.getMessage().contains(\"Unknown DSQL option\")) { sendFreeStatement(stmtHandle, DSQL_DROP); } else throw e;\n}","preventionTips":["Send single option constants, never OR-ed masks.","Prefer DROP (frees everything) unless you need CLOSE semantics."],"tags":["firebird","prepared-statement","free-statement","protocol"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}