{"record":{"id":"2909b3d16d46189f","repo":"vitessio/vitess","slug":"cannot-compile-regexp-v-for-excludetable-v","errorCode":null,"errorMessage":"cannot compile regexp %v for excludeTable: %v","messagePattern":"cannot compile regexp (.+?) for excludeTable: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/mysqlctl/tmutils/schema.go","lineNumber":92,"sourceCode":"\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"cannot compile regexp %v for table: %v\", table, err)\n\t\t\t\t}\n\n\t\t\t\tf.tableREs = append(f.tableREs, re)\n\t\t\t} else {\n\t\t\t\tf.tableNames = append(f.tableNames, table)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(excludeTables) > 0 {\n\t\tf.filterExcludeTables = true\n\t\tfor _, table := range excludeTables {\n\t\t\tif strings.HasPrefix(table, \"/\") {\n\t\t\t\ttable = strings.Trim(table, \"/\")\n\t\t\t\tre, err := regexp.Compile(table)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"cannot compile regexp %v for excludeTable: %v\", table, err)\n\t\t\t\t}\n\n\t\t\t\tf.excludeTableREs = append(f.excludeTableREs, re)\n\t\t\t} else {\n\t\t\t\tf.excludeTableNames = append(f.excludeTableNames, table)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn f, nil\n}\n\n// Includes returns whether a tableName/tableType should be included in this TableFilter.\nfunc (f *TableFilter) Includes(tableName string, tableType string) bool {\n\tif f.filterTables {\n\t\tmatches := false\n\t\tfor _, name := range f.tableNames {\n\t\t\tif strings.EqualFold(name, tableName) {","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/mysqlctl/tmutils/schema.go#L74-L110","documentation":"NewTableFilter treats entries in excludeTables that start with '/' as regular expressions; if such an entry fails regexp.Compile, this error is returned and the TableFilter is not created. Functionally identical to the tables variant, but for the exclusion list.","triggerScenarios":"Calling NewTableFilter (or higher-level GetSchema flows that pass excludeTables, e.g. vtctl schema commands) with an invalid /regex/ entry in the excludeTables slice.","commonSituations":"Malformed exclusion pattern like '/_(tmp$/'; unescaped metacharacters from copy-paste; shell quoting issues mangling the pattern before it reaches the API.","solutions":["Correct the regexp in excludeTables; test it with a quick regexp.Compile check first","Escape regex metacharacters in literal table names","Drop the leading/trailing slashes if you intended an exact-name exclusion"],"exampleFix":"// before\ntmutils.NewTableFilter(nil, []string{\"/_test[/\"}, false)\n// after\ntmutils.NewTableFilter(nil, []string{\"/_test_.*\"}, false)","handlingStrategy":"validation","validationCode":"for _, t := range excludeTables {\n    if strings.HasPrefix(t, \"/\") {\n        if _, err := regexp.Compile(strings.Trim(t, \"/\")); err != nil {\n            return fmt.Errorf(\"invalid excludeTable regexp %q: %v\", t, err)\n        }\n    }\n}","typeGuard":"func isRegexExcludeFilter(entry string) bool {\n    return strings.HasPrefix(entry, \"/\")\n}","tryCatchPattern":"f, err := tmutils.NewTableFilter(nil, excludeTables, false)\nif err != nil {\n    return vterrors.Wrapf(err, \"invalid excludeTables configuration\")\n}","preventionTips":["Test exclusion regexps against the expected table list before use","Quote patterns properly in shell to avoid metacharacter mangling","Prefer exact names for simple exclusions and reserve /regex/ for real patterns","Add endtoend/config validation for exclude-table flags"],"tags":["regex","schema","configuration","vitess"],"backgroundTag":"invalid-regex-pattern","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}