{"record":{"id":"1af656840f75492a","repo":"xai-org/x-algorithm","slug":"func-name-funcname-does-not-match-funcnamerege","errorCode":null,"errorMessage":"Func name '$funcName' does not match $funcNameRegex.","messagePattern":"Func name '\\$funcName' does not match \\$funcNameRegex\\.","errorType":"validation","errorClass":"ConfigFailure","httpStatus":null,"severity":"error","filePath":"botmaker/src/scala/com/twitter/botmaker/runtime/config/ServiceConfigs.scala","lineNumber":80,"sourceCode":"  def validateEventType(eventType: String): Unit = {\n    if (eventTypeRegex.findFirstIn(eventType).isEmpty) {\n      throw ConfigFailure(\n        s\"Event type '$eventType' does not match $eventTypeRegex.\"\n      )\n    }\n  }\n\n  def validateFieldName(fieldName: String): Unit = {\n    if (fieldNameRegex.findFirstIn(fieldName).isEmpty) {\n      throw ConfigFailure(\n        s\"Field name '$fieldName' does not match $fieldNameRegex.\"\n      )\n    }\n  }\n\n  def validateFuncName(funcName: String): Unit = {\n    if (funcNameRegex.findFirstIn(funcName).isEmpty) {\n      throw ConfigFailure(\n        s\"Func name '$funcName' does not match $funcNameRegex.\"\n      )\n    }\n  }\n\n  def validateEndpoint(endpoint: String): Unit = {\n    if (endpoint != \"ScribeClient\"\n      && endpointRegex.findFirstIn(endpoint).isEmpty) {\n      throw ConfigFailure(\n        s\"Endpoint '$endpoint' does not match $endpointRegex.\"\n      )\n    }\n  }\n\n  def validateDataset(dataset: String): Unit = {\n    if (datasetRegex.findFirstIn(dataset).isEmpty) {\n      throw ConfigFailure(\n        s\"Dataset '$dataset' does not match $datasetRegex.\"","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/botmaker/src/scala/com/twitter/botmaker/runtime/config/ServiceConfigs.scala#L62-L98","documentation":"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.","triggerScenarios":"Registering a config that declares a function whose name fails funcNameRegex — e.g. hyphens, leading digits, or operator characters in the function name.","commonSituations":"Deriving function names from dataset or scribe names that contain '-' or '.'; autogenerated names prefixed with digits; name mangling from another language boundary.","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"],"exampleFix":"// before\nfunc(\"process-events\")\n\n// after\nfunc(\"processEvents\")","handlingStrategy":"type-guard","validationCode":"FUNC_NAME_RE = re.compile(r'^[a-zA-Z][a-zA-Z0-9_]*$')\nassert FUNC_NAME_RE.match(fn), f\"bad func name {fn}\"","typeGuard":"def isValidFuncName(name: str) -> bool:\n    return bool(re.match(r'^[a-zA-Z][a-zA-Z0-9_]*$', name))","tryCatchPattern":null,"preventionTips":["Use a slug-to-camelCase converter for generated names","Keep function name generation in one tested helper"],"tags":["botmaker","scala","naming-convention","config-validation"],"backgroundTag":"identifier-validation-failed","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}