{"record":{"id":"a507c3f052461c01","repo":"crowdsecurity/crowdsec","slug":"unknown-schema-option-q","errorCode":null,"errorMessage":"unknown schema option %q","messagePattern":"unknown schema option %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/appsec/appsec.go","lineNumber":1933,"sourceCode":"\treturn w.RequestValidator.RegisterBodyDecoder(contentType, decoderName)\n}\n\nfunc parseSchemaOptions(opts map[string]any) (*apivalidation.SchemaOptions, error) {\n\tout := &apivalidation.SchemaOptions{}\n\tfor k, v := range opts {\n\t\ts, ok := v.(string)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"schema option %q must be a string, got %T\", k, v)\n\t\t}\n\t\tswitch k {\n\t\tcase \"on_route_not_found\":\n\t\t\tout.OnRouteNotFound = apivalidation.Policy(s)\n\t\tcase \"on_method_not_allowed\":\n\t\t\tout.OnMethodNotAllowed = apivalidation.Policy(s)\n\t\tcase \"on_unsupported_security_scheme\":\n\t\t\tout.OnUnsupportedSecurityScheme = apivalidation.Policy(s)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown schema option %q\", k)\n\t\t}\n\t}\n\treturn out, nil\n}\n\n// validationErrorVarKeys lists the keys published into state.HookVars by\n// ValidateRequestWithSchema. Keeping them centralized makes it easy to reset\n// them all at the start of each validation call.\nvar validationErrorVarKeys = []string{\n\t\"validation_error\",\n\t\"validation_error_reason\",\n\t\"validation_error_field\",\n\t\"validation_error_message\",\n\t\"validation_error_value\",\n\t\"validation_error_expected\",\n}\n\n// ValidateRequestWithSchema validates r against the OpenAPI schema registered","sourceCodeStart":1915,"sourceCodeEnd":1951,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/appsec/appsec.go#L1915-L1951","documentation":"parseSchemaOptions hit a map key that is not one of the recognized schema option names (on_route_not_found, on_method_not_allowed, on_unsupported_security_scheme, ...). The option name is echoed; it is a typo or an option from a newer/older crowdsec version.","triggerScenarios":"Thrown at pkg/appsec/appsec.go:1933 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix or remove the unknown key in the appsec api_validation schema options block","Check the documented option names for the installed crowdsec version — misspellings are the common cause"],"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-14T05:17:10.506Z"}