sequelize/sequelize · error · Error
The maxExecutionTimeMs option is not supported by ${this.dia
Error message
The maxExecutionTimeMs option is not supported by ${this.dialect.name} What it means
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.
Source
Thrown at packages/core/src/abstract-dialect/query-generator.js:2699
}
_throwOnEmptyAttributes(attributes, extraInfo = {}) {
if (attributes.length > 0) {
return;
}
const asPart = (extraInfo.as && `as ${extraInfo.as}`) || '';
const namePart = (extraInfo.modelName && `for model '${extraInfo.modelName}'`) || '';
const message = `Attempted a SELECT query ${namePart} ${asPart} without selecting any columns`;
throw new sequelizeError.QueryError(message.replaceAll(/ +/g, ' '));
}
_validateSelectOptions(options) {
if (
options.maxExecutionTimeHintMs != null &&
!this.dialect.supports.maxExecutionTimeHint.select
) {
throw new Error(`The maxExecutionTimeMs option is not supported by ${this.dialect.name}`);
}
}
_getBeforeSelectAttributesFragment(_options) {
return '';
}
selectFromTableFragment(options, model, attributes, tables, mainTableAs) {
this._throwOnEmptyAttributes(attributes, { modelName: model && model.name, as: mainTableAs });
this._validateSelectOptions(options);
let fragment = 'SELECT';
fragment += this._getBeforeSelectAttributesFragment(options);
fragment += ` ${attributes.join(', ')} FROM ${tables}`;
if (options.groupedLimit) {
fragment += ` ${this.#internals.getAliasToken()} ${mainTableAs}`;View on GitHub (pinned to 7e1deec499)
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.
Example fix
// before
const opts = { maxExecutionTimeHintMs: 5000 };
await User.findAll(opts);
// after
const opts = {};
if (sequelize.dialect.supports.maxExecutionTimeHint?.select) {
opts.maxExecutionTimeHintMs = 5000;
}
await User.findAll(opts); Defensive patterns
Strategy: validation
Validate before calling
function withMaxExecutionTime(opts, sequelize) {
if (opts.maxExecutionTimeHintMs != null && !sequelize.dialect.supports.maxExecutionTimeHint?.select) {
const { maxExecutionTimeHintMs, ...rest } = opts;
return rest; // strip unsupported option
}
return opts;
}
// or throw early instead of stripping Type guard
function dialectSupportsMaxExec(sequelize) {
return Boolean(sequelize.dialect.supports.maxExecutionTimeHint?.select);
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- The index hint type "${hint.type}" is invalid or not support
- literal() cannot be used in the "returning" option array in
- sequelize.setSessionVariables is only supported for mysql or
- Invalid session variable name "${key}". Use a 1-64 character
- If specified, the "length" option must be one of: ${validTex
AI-assisted analysis of sequelize/sequelize@7e1deec499 (2026-08-03).
Data as JSON: /data/errors/615aa26c5181a40c.json.
Report an issue: GitHub.