{"record":{"id":"5c5897627b1b84e5","repo":"crowdsecurity/crowdsec","slug":"filter-parameter-s-is-unknown-s-w","errorCode":null,"errorMessage":"filter parameter '%s' is unknown (=%s): %w","messagePattern":"filter parameter '(.+?)' is unknown \\(=(.+?)\\): %w","errorType":"exception","errorClass":"InvalidFilter","httpStatus":null,"severity":"error","filePath":"pkg/database/alertfilter.go","lineNumber":251,"sourceCode":"\t\t\t}\n\n\t\t\tif hasActiveDecision {\n\t\t\t\tpredicates = append(predicates, alert.HasDecisionsWith(decision.UntilGTE(time.Now().UTC())))\n\t\t\t} else {\n\t\t\t\tpredicates = append(predicates, alert.Not(alert.HasDecisions()))\n\t\t\t}\n\t\tcase \"kind\":\n\t\t\tpredicates = append(predicates, alert.KindEQ(value[0]))\n\t\tcase \"limit\":\n\t\t\tcontinue\n\t\tcase \"sort\":\n\t\t\tcontinue\n\t\tcase \"simulated\":\n\t\t\tcontinue\n\t\tcase \"with_decisions\":\n\t\t\tcontinue\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"filter parameter '%s' is unknown (=%s): %w\", param, value[0], InvalidFilter)\n\t\t}\n\t}\n\n\tif err := handleAlertIPPredicates(rng, contains, &predicates); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn predicates, nil\n}\n\nfunc applyAlertFilter(alerts *ent.AlertQuery, filter map[string][]string) (*ent.AlertQuery, error) {\n\tpreds, err := alertPredicatesFromFilter(filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn alerts.Where(preds...), nil\n}","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/database/alertfilter.go#L233-L269","documentation":"Returned by alertPredicatesFromFilter when a filter parameter in the query string is not in the switch's known list. It names the unknown parameter and its value, wrapping the InvalidFilter sentinel, so callers know exactly which key was rejected.","triggerScenarios":"LAPI alerts list/delete request includes a query param not handled by the switch (e.g. ?ip=1.2.3.4 instead of ?scope=ip&value=1.2.3.4, or a typo like sincee=).","commonSituations":"Outdated clients using removed/renamed filter keys after a crowdsec upgrade, typos in hand-written API calls, custom scripts guessing parameter names.","solutions":["Check the LAPI swagger (pkg/models/localapi_swagger.yaml) for the accepted filter keys and rename the parameter accordingly.","Use cscli or an up-to-date SDK instead of hand-built query strings.","If your client uses a removed parameter, migrate to the current equivalent (e.g. scope/value pairs for IP filters).","Consult the API docs for the exact parameter names: since, until, scope, value, scenario, origin, contains, has_active_decision, include_capi, simulated, with_decisions, etc."],"exampleFix":"// before\nGET /v1/alerts?ip=1.2.3.4\n// after\nGET /v1/alerts?scope=ip&value=1.2.3.4","handlingStrategy":"validation","validationCode":"var validParams = map[string]bool{\"since\":true,\"until\":true,\"scope\":true,\"value\":true,\"scenario\":true,\"contains\":true,\"has_active_decision\":true,\"include_capi\":true,\"simulated\":true,\"with_decisions\":true}\nfor k := range params {\n    if !validParams[k] {\n        return fmt.Errorf(\"unknown filter param %q\", k)\n    }\n}","typeGuard":null,"tryCatchPattern":"resp, err := client.Alerts.List(ctx, opts)\nvar apiErr *crowdsec.ApiErrorResponse\nif err != nil && errors.As(err, &apiErr) {\n    if strings.Contains(*apiErr.Message, \"is unknown\") {\n        // log the rejected param name from the message and fix the caller\n    }\n}","preventionTips":["Generate query params from the LAPI swagger spec instead of hardcoding","After crowdsec upgrades, diff your client's params against the current swagger","Use cscli output as reference for valid filter names","Avoid passing through arbitrary user query params to LAPI"],"tags":["go","lapi","query-params"],"backgroundTag":"invalid-query-parameter","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"}