xai-org/x-algorithm · error · ConfigFailure

ScheduledEvent ${config.eventType} intervalMillis must be a

Error message

ScheduledEvent ${config.eventType} intervalMillis must be a postivie value.

What it means

When registering a ScheduledEventConfig, BotMaker requires intervalMillis (the period between event firings) to be strictly positive. A zero or negative interval would cause an infinite loop or nonsensical scheduling, so ConfigFailure is thrown with the offending eventType in the message (note the typo 'postivie' in the source).

Source

Thrown at botmaker/src/scala/com/twitter/botmaker/runtime/config/ScheduledEventConfigs.scala:36

  ): ScheduledEventConfig = {
    context.getRuntime.addScheduledEvent(config)
    config
  }
}

trait ScheduledEventConfigs extends ServiceConfigs with EventTypeConfigs {

  private final val scheduledEvents = mutable.ArrayBuffer[ScheduledEventConfig]()

  final def getScheduledEvents: Seq[ScheduledEventConfig] = scheduledEvents.toSeq

  final def addScheduledEvent(config: ScheduledEventConfig): Option[BotMakerEventTypeConfig] = {

    unique(ScheduledEvent, config.eventType)
    unique(Endpoint, config.eventType)

    if (config.intervalMillis <= 0) {
      throw ConfigFailure(
        s"ScheduledEvent ${config.eventType} intervalMillis must be a postivie value."
      )
    }

    scheduledEvents.append(config)

    addEventType(
      new BotMakerEventTypeConfig()
        .setEventType(config.eventType)
    )

  }

  override def debug(dbg: RuntimeDebugger): Unit = {
    super.debug(dbg)

    dbg.open("scheduledEvents", scheduledEvents) foreach { d =>
      scheduledEvents foreach { se => d.info(se.eventType, se.toString) }

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Set intervalMillis to a positive millisecond value appropriate to the event cadence
  2. Check that the code path constructing ScheduledEventConfig actually sets intervalMillis (no default of 0 slipping through)
  3. Add a unit test asserting intervalMillis > 0 for every scheduled event you register

Example fix

// before
addScheduledEvent(ScheduledEventConfig(eventType = "DailyDigest", intervalMillis = 0))

// after
addScheduledEvent(ScheduledEventConfig(eventType = "DailyDigest", intervalMillis = 86400000L))
Defensive patterns

Strategy: validation

Validate before calling

def addEvent(cfg):
    assert cfg.intervalMillis > 0, f"{cfg.eventType}: intervalMillis must be > 0"
    addScheduledEvent(cfg)

Try / catch

try:
    addScheduledEvent(cfg)
except ConfigFailure as e:
    if "intervalMillis" in str(e):
        cfg = cfg.copy(intervalMillis=DEFAULT_INTERVAL_MS); addScheduledEvent(cfg)
    else:
        raise

Prevention

When it happens

Trigger: Calling addScheduledEvent with a ScheduledEventConfig whose intervalMillis <= 0; the eventType/endpoint uniqueness checks run first, then this interval validation.

Common situations: Defaulting intervalMillis to 0 in a case class and forgetting to override; computing the interval from a cron/duration conversion that yields 0; passing seconds instead of milliseconds resulting in truncation to 0.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28). Data as JSON: /api/errors/920ab00b70cfa33d. Report an issue: GitHub.