twentyhq/twenty · error · Error

Failed to describe cron expression

Error message

Failed to describe cron expression: ${errorMessage}

What it means

Top-level catch-all wrapper in describeCronExpression: any error thrown inside the try block (most commonly from parseCronExpression) is re-thrown with the prefix 'Failed to describe cron expression: ' plus the inner error message. This is the error users see for malformed cron input.

Solutions

  1. Read the suffixed inner message to identify which validation failed (field count vs cron-parser range error).
  2. Correct the cron expression to valid 5-field syntax with in-range values.
  3. If surfacing to users, strip the 'Failed to describe cron expression: ' prefix and show only the inner reason.

Example fix

// before: cron '99 99 * * *'  -> 'Failed to describe cron expression: Invalid cron expression: ...'
// after:  cron '0 9 * * *'   -> 'at 09:00'
Defensive patterns

Strategy: try-catch

Validate before calling

const tryDescribeCron = (expr: string): string => {
  try { return describeCronExpression(expr); }
  catch (e) { return ''; }
};

Type guard

const isValidCron = (expr: string): boolean => {
  try { parseCronExpression(expr); return true; } catch { return false; }
};

Try / catch

try {
  const human = describeCronExpression(expr);
} catch (e) {
  // strip the wrapper prefix to show only the inner reason
  const inner = (e as Error).message.replace(/^Failed to describe cron expression: /, '');
  setScheduleError(inner);
}

Prevention

When it happens

Trigger: parseCronExpression throws (invalid field count, cron-parser rejects out-of-range values like minute 99). A descriptor helper throws on unsupported syntax. Any non-Error throw produces 'Unknown error'.

Common situations: User types an invalid cron expression in the workflow schedule editor (e.g., '99 99 * * *', '*/5 / / * *', too many fields). Out-of-range or non-numeric field values.

Related errors


AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12). Data as JSON: /api/errors/e0ddee75b98ae60a. Report an issue: GitHub.

Appendix: source

Thrown at packages/twenty-front/src/modules/workflow/workflow-trigger/utils/cron-to-human/describeCronExpression.ts:114

    }
    const monthsDesc = getMonthsDescription(
      parts.month,
      mergedOptions,
      localeCatalog,
    );
    if (isDefined(monthsDesc) && monthsDesc !== '') {
      descriptions.push(monthsDesc);
    }

    if (descriptions.length === 0) {
      return t`every minute`;
    }
    // Simple joining - just use spaces, no commas for cleaner descriptions
    return descriptions.join(' ');
  } catch (error) {
    const errorMessage =
      error instanceof Error ? error.message : 'Unknown error';
    throw new Error(`Failed to describe cron expression: ${errorMessage}`);
  }
};

View on GitHub (pinned to 1f5dd2bbd2)