xai-org/x-algorithm · error · ConfigFailure
Field name '$fieldName' does not match $fieldNameRegex.
Error message
Field name '$fieldName' does not match $fieldNameRegex.
What it means
Field names in BotMaker configs (struct/dataclass fields passed through the codegen pipeline) must match fieldNameRegex. validateFieldName throws ConfigFailure naming both the field and the regex when the field identifier does not conform.
Source
Thrown at botmaker/src/scala/com/twitter/botmaker/runtime/config/ServiceConfigs.scala:72
}
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."
)
}
}
def validateEndpoint(endpoint: String): Unit = {
if (endpoint != "ScribeClient"
&& endpointRegex.findFirstIn(endpoint).isEmpty) {
throw ConfigFailure(
s"Endpoint '$endpoint' does not match $endpointRegex."View on GitHub (pinned to 24c60942c5)
Solutions
- Rename the field to plain alphanumeric identifier style (typically camelCase)
- If the source schema has odd keys, map them to safe Scala identifiers and translate at the serialization boundary
- Pre-validate all field names against the same regex in a unit test of your config module
Example fix
// before case class Rule(match-threshold: Int) // invalid identifier // after case class Rule(matchThreshold: Int)
Defensive patterns
Strategy: type-guard
Validate before calling
FIELD_NAME_RE = re.compile(r'^[a-zA-Z][a-zA-Z0-9_]*$') bad = [f for f in dataclass_fields(Cfg) if not FIELD_NAME_RE.match(f.name)] assert not bad, bad
Type guard
def isValidFieldName(name: str) -> bool:
return bool(re.match(r'^[a-zA-Z][a-zA-Z0-9_]*$', name)) Prevention
- Map external schema keys to safe identifiers at the boundary
- Lint config case classes for exotic field names
When it happens
Trigger: Defining a config data type whose field name fails fieldNameRegex — e.g. names with hyphens, '$', leading underscores or digits, or reserved punctuation — when the config is registered and validated.
Common situations: Mirroring an external JSON/Thrift schema whose keys contain dashes or '@'; Scala keywords or synthetic field names like 'x$1'; fields copied from YAML with odd characters.
Related errors
- Event type '$eventType' does not match $eventTypeRegex.
- Func name '$funcName' does not match $funcNameRegex.
- Endpoint '$endpoint' does not match $endpointRegex.
- Dataset '$dataset' does not match $datasetRegex.
- TypeName '$typename' does not match $typeNameRegex.
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/910cdd9b7af133aa.
Report an issue: GitHub.