{"id":"f5fa4590ee330fc5","repo":"sequelize/sequelize","slug":"this-getdialect-name-does-not-support-the-bi-f5fa45","errorCode":null,"errorMessage":"${this._getDialect().name} does not support the BINARY option for data types with a length greater than 4000.","messagePattern":"(.+?) does not support the BINARY option for data types with a length greater than 4000\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ibmi/src/_internal/data-types-overrides.ts","lineNumber":58,"sourceCode":"      }\n\n      return `BLOB(${this.options.length})`;\n    }\n\n    return 'BLOB(1M)';\n  }\n}\n\nexport class STRING extends BaseTypes.STRING {\n  toSql() {\n    const length = this.options.length ?? 255;\n\n    if (this.options.binary) {\n      if (length <= 4000) {\n        return `VARCHAR(${length}) FOR BIT DATA`;\n      }\n\n      throw new Error(\n        `${this._getDialect().name} does not support the BINARY option for data types with a length greater than 4000.`,\n      );\n    }\n\n    if (length <= 4000) {\n      return `VARCHAR(${length})`;\n    }\n\n    return `CLOB(${length})`;\n  }\n}\n\nexport class CHAR extends BaseTypes.CHAR {\n  toSql() {\n    if (this.options.binary) {\n      return `CHAR(${this.options.length ?? 255}) FOR BIT DATA`;\n    }\n","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/sequelize/sequelize/blob/7e1deec499d5afbb8d1877c2f4d545cead1214ec/packages/ibmi/src/_internal/data-types-overrides.ts#L40-L76","documentation":"Thrown by the IBMi STRING data-type override's toSql when the binary option is set and the declared length exceeds 4000. IBMi/Db2 maps STRING+binary to VARCHAR(n) FOR BIT DATA, which has a hard 4000-byte ceiling; longer binary strings must use BLOB.","triggerScenarios":"Defining a model attribute as DataTypes.STRING({ length: 8000, binary: true }) (or STRING.BINARY with length>4000) and triggering DDL generation (sync/autoMigrate).","commonSituations":"Porting a model from MySQL/Postgres with a long binary string column, or assuming STRING.BINARY scales to any length.","solutions":["Reduce the length to <= 4000 for the binary string column.","Switch the column to DataTypes.BLOB for binary payloads larger than 4000 bytes.","Split the data or store a reference/identifier instead of a long binary blob."],"exampleFix":"// before\nDataTypes.STRING({ length: 8000, binary: true })\n// after\nDataTypes.BLOB","handlingStrategy":"validation","validationCode":"if (attr.binary && typeof attr.length === 'number' && attr.length > 4000) {\n  throw new Error('IBMi STRING binary length cannot exceed 4000; use BLOB');\n}","typeGuard":"function isValidIbmiBinaryString(attr) {\n  return !attr.binary || attr.length == null || attr.length <= 4000;\n}","tryCatchPattern":null,"preventionTips":["Cap binary STRING length at 4000 on IBMi.","Use BLOB for larger binary payloads.","Review model definitions when porting from other dialects."],"tags":["ibmi","data-types","binary","varchar","ddl"],"analyzedSha":"7e1deec499d5afbb8d1877c2f4d545cead1214ec","analyzedAt":"2026-08-03T18:58:44.549Z","schemaVersion":2}