xai-org/x-algorithm · error · ConfigFailure
Regex cacheExpirationMillis must be greater than 0
Error message
Regex cacheExpirationMillis must be greater than 0
What it means
BotMaker validates that the regex cache expiration (cacheExpirationMillis) is positive. This value drives how long compiled regexes stay cached; zero or negative expiration is meaningless, so ConfigFailure is thrown when the RegexOptions are applied (the final check before regexOptions = config).
Source
Thrown at botmaker/src/scala/com/twitter/botmaker/runtime/config/RegexConfigs.scala:47
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
- Set cacheExpirationMillis to a positive duration in milliseconds (e.g. 3600000)
- Verify the value's source (hocon/env) is actually populated and in milliseconds
- Re-run config validation in a test before deploying so failures surface at build time
Example fix
// before regexOptions = config.copy(cacheExpirationMillis = 0) // after regexOptions = config.copy(cacheExpirationMillis = 3_600_000L)
Defensive patterns
Strategy: validation
Validate before calling
assert opts.cacheExpirationMillis > 0, "cacheExpirationMillis must be positive milliseconds"
Try / catch
try:
applyRegexOptions(opts)
except ConfigFailure as e:
log.warning("regex config rejected: %s", e); raise Prevention
- Use time-based helper constructors that reject non-positive durations
- Document units (milliseconds) at the config surface
When it happens
Trigger: Registering RegexOptions with cacheExpirationMillis <= 0; usually the last validation to fire after timeoutMillis and maximumCacheItems have passed.
Common situations: Setting expiration to 0 thinking it disables expiration (it does not); units confusion (passing seconds where millis expected, or 0 from an unset knob); mutating a shared config case class after construction.
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
- Regex maximumCacheItems must be greater than 0
- ScheduledEvent ${config.eventType} intervalMillis must be a
- Conflict config name:${nameSeq.mkString}
- Event type '$eventType' does not match $eventTypeRegex.
- Field name '$fieldName' does not match $fieldNameRegex.
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/e0be7f76633771cb.
Report an issue: GitHub.