{"record":{"id":"de610b6adecee158","repo":"apache/shardingsphere","slug":"connection-s-is-not-registered","errorCode":null,"errorMessage":"Connection [%s] is not registered.","messagePattern":"Connection \\[(.+?)\\] is not registered\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"warning","filePath":"database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdBatchRegistry.java","lineNumber":65,"sourceCode":"     *\n     * @param connectionId connection ID\n     */\n    public void registerConnection(final int connectionId) {\n        batchRegistry.put(connectionId, new ConcurrentHashMap<>());\n    }\n    \n    /**\n     * Register batch metadata.\n     *\n     * @param connectionId connection ID\n     * @param statementId statement ID\n     * @param batchStatement batch statement\n     * @throws IllegalStateException if connection is not registered\n     */\n    public void registerBatchStatement(final int connectionId, final int statementId, final FirebirdBatchStatement batchStatement) {\n        Map<Integer, FirebirdBatchStatement> statements = batchRegistry.get(connectionId);\n        if (statements == null) {\n            throw new IllegalStateException(\"Connection [\" + connectionId + \"] is not registered.\");\n        }\n        statements.put(statementId, batchStatement);\n    }\n    \n    /**\n     * Get batch metadata.\n     *\n     * @param connectionId connection ID\n     * @param statementId statement ID\n     * @return batch statement or null if not found\n     */\n    public FirebirdBatchStatement getBatchStatement(final int connectionId, final int statementId) {\n        Map<Integer, FirebirdBatchStatement> statements = batchRegistry.get(connectionId);\n        if (statements == null) {\n            return null;\n        }\n        return statements.get(statementId);\n    }","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdBatchRegistry.java#L47-L83","documentation":"UnsupportedSQLOperationException thrown by PostgreSQLComCloseExecutor when a Close message arrives whose type byte is neither PREPARED_STATEMENT ('S') nor PORTAL ('P'). The extended-protocol Close command must target one of those two named objects; anything else means a malformed or unexpected Close type and the switch falls to default.","triggerScenarios":"Sending a Close message with a type byte other than 'S' or 'P' — typically a hand-written client, a corrupted stream, or a driver bug constructing the Close packet incorrectly.","commonSituations":"Custom PostgreSQL wire-protocol implementations; protocol fuzzing; a driver version that emits an invalid Close type; byte-level corruption from middleware/LB between client and proxy.","solutions":["Fix the client to send Close with type 'S' (close prepared statement) or 'P' (close portal) per the PostgreSQL Frontend/Backend protocol.","If using a custom driver, validate the Close message construction against the protocol spec before sending.","Upgrade or patch the client driver if a released version emits the malformed Close.","Inspect the wire bytes (protocol trace) to confirm whether the type byte is corrupted in transit."],"exampleFix":"// before (custom client): wrong type byte\ncloseMessage(type='X', name=portalName);\n\n// after\ncloseMessage(type='P', name=portalName); // or 'S' for prepared statement","handlingStrategy":"validation","validationCode":"// Custom client: validate Close message before sending\nbyte type = closeTarget; // must be 'S' or 'P'\nif (type != 'S' && type != 'P') {\n    throw new IllegalArgumentException(\"Invalid Close type byte: \" + (char) type);\n}\nsendClose(type, name);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Encode Close type strictly as 'S' or 'P' per the PostgreSQL protocol spec.","Unit-test wire-message builders for valid type bytes.","Log the raw type byte when this error appears to distinguish client bugs from corruption."],"tags":["postgresql","extended-protocol","close","protocol"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}