xai-org/x-algorithm · error · ConfigFailure
Func name '$funcName' does not match $funcNameRegex.
Error message
Func name '$funcName' does not match $funcNameRegex.
What it means
Function names declared in BotMaker configs must match funcNameRegex. validateFuncName throws ConfigFailure with the funcName and the pattern when a declared function identifier fails validation, ensuring generated code compiles cleanly.
Source
Thrown at botmaker/src/scala/com/twitter/botmaker/runtime/config/ServiceConfigs.scala:80
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."
)
}
}
def validateDataset(dataset: String): Unit = {
if (datasetRegex.findFirstIn(dataset).isEmpty) {
throw ConfigFailure(
s"Dataset '$dataset' does not match $datasetRegex."View on GitHub (pinned to 24c60942c5)
Solutions
- Rename the function to satisfy funcNameRegex (camelCase identifier)
- Convert external names via a slug-to-camelCase helper before registering
- Assert funcNameRegex compliance in config unit tests
Example fix
// before
func("process-events")
// after
func("processEvents") Defensive patterns
Strategy: type-guard
Validate before calling
FUNC_NAME_RE = re.compile(r'^[a-zA-Z][a-zA-Z0-9_]*$')
assert FUNC_NAME_RE.match(fn), f"bad func name {fn}" Type guard
def isValidFuncName(name: str) -> bool:
return bool(re.match(r'^[a-zA-Z][a-zA-Z0-9_]*$', name)) Prevention
- Use a slug-to-camelCase converter for generated names
- Keep function name generation in one tested helper
When it happens
Trigger: Registering a config that declares a function whose name fails funcNameRegex — e.g. hyphens, leading digits, or operator characters in the function name.
Common situations: Deriving function names from dataset or scribe names that contain '-' or '.'; autogenerated names prefixed with digits; name mangling from another language boundary.
Related errors
- Event type '$eventType' does not match $eventTypeRegex.
- Field name '$fieldName' does not match $fieldNameRegex.
- 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/1af656840f75492a.
Report an issue: GitHub.