mermaid-js/mermaid · error · Error
Failed to find a valid date that was not excluded by `exclud
Error message
Failed to find a valid date that was not excluded by `excludes` after 10,000 iterations.
What it means
Error "Failed to find a valid date that was not excluded by `excludes` after 10,000 iterations." thrown in mermaid-js/mermaid.
Source
Thrown at packages/mermaid/src/diagrams/gantt/ganttDb.js:280
* @param {string[]} excludes - Dates or days to exclude.
* @param {string[]} includes - Dates to always include, even if they match the excludes.
* @returns {[endTime: dayjs.Dayjs, renderEndTime: Date | null]} The new `endTime`, and the end time to render.
* `renderEndTime` may be `null` if `startTime` is newer than `endTime`.
* @throws {Error} If a valid end time cannot be found after 10,000 iterations.
*/
const fixTaskDates = function (startTime, endTime, dateFormat, excludes, includes) {
let invalid = false;
let renderEndTime = null;
const maxEndTime = endTime.add(10000, 'd');
while (startTime <= endTime) {
if (!invalid) {
renderEndTime = endTime.toDate();
}
invalid = isInvalidDate(startTime, dateFormat, excludes, includes);
if (invalid) {
endTime = endTime.add(1, 'd');
if (endTime > maxEndTime) {
throw new Error(
'Failed to find a valid date that was not excluded by `excludes` after 10,000 iterations.'
);
}
}
startTime = startTime.add(1, 'd');
}
return [endTime, renderEndTime];
};
const getStartDate = function (prevTime, dateFormat, str) {
str = str.trim();
// Helper function to check if format is a timestamp format (x or X)
const isTimestampFormat = (format) => {
const trimmedFormat = format.trim();
return trimmedFormat === 'x' || trimmedFormat === 'X';
};
View on GitHub (pinned to d93e9c88c0)
When it happens
Trigger: Thrown at packages/mermaid/src/diagrams/gantt/ganttDb.js:280 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of mermaid-js/mermaid@d93e9c88c0 (2026-08-12).
Data as JSON: /api/errors/69438723bb41f586.
Report an issue: GitHub.