{"record":{"id":"3b509a2442578db5","repo":"alibaba/canal","slug":"error-int-result-length","errorCode":null,"errorMessage":"Error INT_RESULT length: ","messagePattern":"Error INT_RESULT length: ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/UserVarLogEvent.java","lineNumber":96,"sourceCode":"            charsetNumber = 63; /* binary */\n            value = null;\n        } else {\n            type = buffer.getInt8(); // UV_VAL_IS_NULL\n            charsetNumber = (int) buffer.getUint32(); // buf + UV_VAL_TYPE_SIZE\n            final int valueLen = (int) buffer.getUint32(); // buf +\n                                                           // UV_CHARSET_NUMBER_SIZE\n            final int limit = buffer.limit(); /* for restore */\n            buffer.limit(buffer.position() + valueLen);\n\n            /* @see User_var_log_event::print */\n            switch (type) {\n                case REAL_RESULT:\n                    value = Double.valueOf(buffer.getDouble64()); // float8get\n                    break;\n                case INT_RESULT:\n                    if (valueLen == 8) value = Long.valueOf(buffer.getLong64()); // !uint8korr\n                    else if (valueLen == 4) value = Long.valueOf(buffer.getUint32());\n                    else throw new IOException(\"Error INT_RESULT length: \" + valueLen);\n                    break;\n                case DECIMAL_RESULT:\n                    final int precision = buffer.getInt8();\n                    final int scale = buffer.getInt8();\n                    value = buffer.getDecimal(precision, scale); // bin2decimal\n                    break;\n                case STRING_RESULT:\n                    Charset charset = CharsetConversion.getNioCharset(charsetNumber);\n                    value = buffer.getFixString(valueLen, charset);\n                    break;\n                case ROW_RESULT:\n                    // this seems to be banned in MySQL altogether\n                    throw new IOException(\"ROW_RESULT is unsupported\");\n                default:\n                    value = null;\n                    break;\n            }\n            buffer.limit(limit);","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/UserVarLogEvent.java#L78-L114","documentation":"Thrown while decoding a UserVarLogEvent whose value type is INT_RESULT. MySQL stores INT user variables as either 4-byte (32-bit) or 8-byte (64-bit) values. If the declared valueLen is neither 4 nor 8, the payload is structurally invalid and an IOException is thrown. This guards against truncation or corruption of the user-variable value section.","triggerScenarios":"A UserVarLogEvent with type INT_RESULT and a value length other than 4 or 8 bytes. Produced by binlog corruption, truncation, or a source that mis-encodes user-variable events.","commonSituations":"Replicating SET @var = <bigint> statements from a corrupted binlog; a partial binlog read; a MySQL fork with non-standard user-variable encoding.","solutions":["Inspect the binlog at the reported position with mysqlbinlog to confirm the UserVar event is intact.","If the binlog is corrupt, reseed Canal from a valid position.","Upgrade Canal to match the master version.","Avoid relying on user-variable events if the replication target does not need them."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"boolean isValidIntResultLen(int valueLen) {\n    return valueLen == 4 || valueLen == 8;\n}","typeGuard":null,"tryCatchPattern":"try {\n    userVarEvent.parse();\n} catch (IOException e) {\n    if (e.getMessage().startsWith(\"Error INT_RESULT length\")) {\n        logger.warn(\"Corrupt INT user variable, skipping event\");\n        // skip / null the value\n    } else throw e;\n}","preventionTips":["Validate binlog integrity at the reported position.","Keep Canal aligned with the master version.","Avoid depending on user-variable events if not needed downstream."],"tags":["binlog","user-var-event","int-result","parsing"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}