{"record":{"id":"2fb2be7391cbf6f7","repo":"crowdsecurity/crowdsec","slug":"unknown-match-type-s","errorCode":null,"errorMessage":"unknown match type '%s'","messagePattern":"unknown match type '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/appsec/appsec_rule/modsecurity.go","lineNumber":347,"sourceCode":"\t\tif len(rule.Variables) == 0 {\n\t\t\tr.WriteString(mappedZone)\n\t\t} else {\n\t\t\tfor j, variable := range rule.Variables {\n\t\t\t\tif j > 0 {\n\t\t\t\t\tr.WriteByte('|')\n\t\t\t\t}\n\n\t\t\t\tr.WriteString(fmt.Sprintf(\"%s%s:%s%s\", zonePrefix, mappedZone, variablePrefix, variable))\n\t\t\t}\n\t\t}\n\t}\n\n\tr.WriteByte(' ')\n\n\tif rule.Match.Type != \"\" {\n\t\tmatch, ok := matchMap[rule.Match.Type]\n\t\tif !ok {\n\t\t\treturn \"\", fmt.Errorf(\"unknown match type '%s'\", rule.Match.Type)\n\t\t}\n\n\t\tprefix := \"\"\n\t\tif rule.Match.Not {\n\t\t\tprefix = \"!\"\n\t\t}\n\n\t\tr.WriteString(fmt.Sprintf(`\"%s%s %s\"`, prefix, match, rule.Match.Value))\n\t}\n\n\tvar msg string\n\tif appsecRuleDescription != \"\" {\n\t\tmsg = appsecRuleDescription\n\t} else {\n\t\tmsg = appsecRuleName\n\t}\n\n\tr.WriteString(fmt.Sprintf(` \"id:%d,phase:2`, m.generateRuleID(rule, appsecRuleName, opts.position)))","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/appsec/appsec_rule/modsecurity.go#L329-L365","documentation":"The rule's Match.Type string has no entry in matchMap (the match-type→modsecurity operator mapping). The custom rule declares an operator the converter does not know, so it cannot be emitted as a SecRule expression.","triggerScenarios":"Thrown at pkg/appsec/appsec_rule/modsecurity.go:347 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set match.type in the custom rule to one of the documented match types (equals, contains, starts_with, ends_with, regex, ...)","Check spelling/case against the version's supported match map"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}