xai-org/x-algorithm · error · ConfigFailure

Regex timeoutMilis must be greater than 0

Error message

Regex timeoutMilis must be greater than 0

What it means

ConfigFailure thrown by RegexConfigs.addRegexOptions when timeoutMilis <= 0 (note the typo 'Milis' is part of the API). The regex evaluation timeout must be positive to be meaningful.

Source

Thrown at botmaker/src/scala/com/twitter/botmaker/runtime/config/RegexConfigs.scala:35

trait RegexOptionConfigs extends ServiceConfigs {

  private final var regexOptions = new RegexConfig()
    .setTimeoutMilis(1000L)
    .setMaximumPendingRequests(20L)

  final def getRegexOptions: RegexConfig = regexOptions

  final def addRegexOptions(config: RegexConfig): Unit = {

    if (config.maximumPendingRequests <= 0) {
      throw ConfigFailure(
        s"Regex maximumPendingRequests must be greater than 0"
      )
    }

    if (config.timeoutMilis <= 0) {
      throw ConfigFailure(
        s"Regex timeoutMilis must be greater than 0"
      )
    }

    if (config.maximumCacheItems <= 0) {
      throw ConfigFailure(
        s"Regex maximumCacheItems must be greater than 0"
      )
    }

    if (config.cacheExpirationMillis <= 0) {
      throw ConfigFailure(
        s"Regex cacheExpirationMillis must be greater than 0"
      )
    }

    regexOptions = config
  }

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Set timeoutMilis (exact spelling) to a positive millisecond value
  2. Confirm you're populating the typo'd field name timeoutMilis, not timeoutMillis

Example fix

# before
regex:
  timeoutMillis: 0
# after
regex:
  timeoutMilis: 500
Defensive patterns

Strategy: validation

Validate before calling

require(config.timeoutMilis > 0, "timeoutMilis must be positive")

Try / catch

catch { case e: ConfigFailure => fail fast at config load, not at request time }

Prevention

When it happens

Trigger: Registering regex options with timeout_milis: 0 or negative, or the field missing in a context with no default and defaulting through as 0.

Common situations: Placeholder zeros in generated config; users writing timeoutMillis (correct spelling) so the typo'd field is never set and a 0 default is validated.

Understand the failure class

Related errors


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