xai-org/x-algorithm · error · ConfigFailure

Event type '$eventType' does not match $eventTypeRegex.

Error message

Event type '$eventType' does not match $eventTypeRegex.

What it means

Event type names in BotMaker must match eventTypeRegex. validateEventType runs during config registration and throws ConfigFailure (with the offending value and the regex in the message) when the eventType string fails to match, keeping event names uniformly parseable/generatable.

Source

Thrown at botmaker/src/scala/com/twitter/botmaker/runtime/config/ServiceConfigs.scala:64

  def unique(names: Any*): Unit = synchronized {
    val nameSeq = names.toSeq
    if (uniqueNames.contains(nameSeq)) {
      throw ConfigFailure(
        s"Conflict config name:${nameSeq.mkString}"
      )
    }
    uniqueNames += nameSeq
  }

  def validate(condition: Boolean, err: String): Unit = {
    if (!condition) {
      throw ConfigFailure(err)
    }
  }

  def validateEventType(eventType: String): Unit = {
    if (eventTypeRegex.findFirstIn(eventType).isEmpty) {
      throw ConfigFailure(
        s"Event type '$eventType' does not match $eventTypeRegex."
      )
    }
  }

  def validateFieldName(fieldName: String): Unit = {
    if (fieldNameRegex.findFirstIn(fieldName).isEmpty) {
      throw ConfigFailure(
        s"Field name '$fieldName' does not match $fieldNameRegex."
      )
    }
  }

  def validateFuncName(funcName: String): Unit = {
    if (funcNameRegex.findFirstIn(funcName).isEmpty) {
      throw ConfigFailure(
        s"Func name '$funcName' does not match $funcNameRegex."
      )

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Read the exact pattern from eventTypeRegex in ServiceConfigs and rename the eventType to conform (usually UpperCamel or lowerCamel alphanumeric)
  2. Sanitize generated names (strip whitespace/punctuation) before registration
  3. Add a startup assertion that all event types pass the regex before the config is registered

Example fix

// before
endpoint("content-scan-v2")

// after
endpoint("ContentScanV2") // matches eventTypeRegex e.g. ^[A-Z][a-zA-Z0-9_]*$
Defensive patterns

Strategy: type-guard

Validate before calling

import re
EVENT_TYPE_RE = re.compile(r'^[A-Z][a-zA-Z0-9_]*$')  # mirror eventTypeRegex
def validEventType(t): return bool(EVENT_TYPE_RE.match(t))

Type guard

def isValidEventType(name: str) -> bool:
    import re
    return bool(re.match(r'^[A-Z][a-zA-Z0-9_]*$', name))

Try / catch

try:
    registerEvent(evt)
except ConfigFailure as e:
    if "does not match" in str(e):
        registerEvent(toUpperCamelCase(evt))
    else:
        raise

Prevention

When it happens

Trigger: Registering an event/endpoint whose eventType string does not satisfy eventTypeRegex (typically lowerCamelCase alphanumerics; check the eventTypeRegex value in ServiceConfigs for the exact pattern) — e.g. names with dashes, leading digits, spaces, or empty strings.

Common situations: Using kebab-case or snake_case event names; generating event types from dataset names or strings containing punctuation; trailing whitespace from config files.

Related errors


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