{"id":"615aa26c5181a40c","repo":"sequelize/sequelize","slug":"the-maxexecutiontimems-option-is-not-supported-by","errorCode":null,"errorMessage":"The maxExecutionTimeMs option is not supported by ${this.dialect.name}","messagePattern":"The maxExecutionTimeMs option is not supported by (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/abstract-dialect/query-generator.js","lineNumber":2699,"sourceCode":"  }\n\n  _throwOnEmptyAttributes(attributes, extraInfo = {}) {\n    if (attributes.length > 0) {\n      return;\n    }\n\n    const asPart = (extraInfo.as && `as ${extraInfo.as}`) || '';\n    const namePart = (extraInfo.modelName && `for model '${extraInfo.modelName}'`) || '';\n    const message = `Attempted a SELECT query ${namePart} ${asPart} without selecting any columns`;\n    throw new sequelizeError.QueryError(message.replaceAll(/ +/g, ' '));\n  }\n\n  _validateSelectOptions(options) {\n    if (\n      options.maxExecutionTimeHintMs != null &&\n      !this.dialect.supports.maxExecutionTimeHint.select\n    ) {\n      throw new Error(`The maxExecutionTimeMs option is not supported by ${this.dialect.name}`);\n    }\n  }\n\n  _getBeforeSelectAttributesFragment(_options) {\n    return '';\n  }\n\n  selectFromTableFragment(options, model, attributes, tables, mainTableAs) {\n    this._throwOnEmptyAttributes(attributes, { modelName: model && model.name, as: mainTableAs });\n\n    this._validateSelectOptions(options);\n\n    let fragment = 'SELECT';\n    fragment += this._getBeforeSelectAttributesFragment(options);\n    fragment += ` ${attributes.join(', ')} FROM ${tables}`;\n\n    if (options.groupedLimit) {\n      fragment += ` ${this.#internals.getAliasToken()} ${mainTableAs}`;","sourceCodeStart":2681,"sourceCodeEnd":2717,"githubUrl":"https://github.com/sequelize/sequelize/blob/7e1deec499d5afbb8d1877c2f4d545cead1214ec/packages/core/src/abstract-dialect/query-generator.js#L2681-L2717","documentation":"Thrown by `_validateSelectOptions` when `options.maxExecutionTimeHintMs` is set but `dialect.supports.maxExecutionTimeHint.select` is false. `maxExecutionTimeHintMs` is a MariaDB/MySQL-specific SELECT hint (translates to `MAX_EXECUTION_TIME(...)`); other dialects cannot honor it, so Sequelize rejects it rather than silently ignoring it.","triggerScenarios":"Calling any find/select operation (`findAll`, `findOne`, `findAndCountAll`, raw SELECT via queryInterface) with `{ maxExecutionTimeHintMs: 5000 }` on a dialect that does not support it (postgres, sqlite, mssql, db2, ibmi, snowflake).","commonSituations":"Sharing option-building code across multi-dialect test suites. Setting the option globally via default scopes. Copying a MySQL-only snippet into a Postgres service. Upgrading and not realizing the option is dialect-gated.","solutions":["Conditionally set the option only when supported: `...(dialect.supports.maxExecutionTimeHint?.select ? { maxExecutionTimeHintMs: ms } : {})`.","Remove `maxExecutionTimeHintMs` from the options object for non-MySQL/MariaDB dialects.","Implement dialect-specific query option factories rather than shared option bags."],"exampleFix":"// before\nconst opts = { maxExecutionTimeHintMs: 5000 };\nawait User.findAll(opts);\n\n// after\nconst opts = {};\nif (sequelize.dialect.supports.maxExecutionTimeHint?.select) {\n  opts.maxExecutionTimeHintMs = 5000;\n}\nawait User.findAll(opts);","handlingStrategy":"validation","validationCode":"function withMaxExecutionTime(opts, sequelize) {\n  if (opts.maxExecutionTimeHintMs != null && !sequelize.dialect.supports.maxExecutionTimeHint?.select) {\n    const { maxExecutionTimeHintMs, ...rest } = opts;\n    return rest; // strip unsupported option\n  }\n  return opts;\n}\n// or throw early instead of stripping","typeGuard":"function dialectSupportsMaxExec(sequelize) {\n  return Boolean(sequelize.dialect.supports.maxExecutionTimeHint?.select);\n}","tryCatchPattern":null,"preventionTips":["Don't share the same options object across dialects.","Gate dialect-specific hints behind capability checks.","Keep multi-dialect tests that assert options are accepted per dialect."],"tags":["mysql","mariadb","dialect-specific","select","query-generator"],"analyzedSha":"7e1deec499d5afbb8d1877c2f4d545cead1214ec","analyzedAt":"2026-08-03T18:58:44.549Z","schemaVersion":2}