{"record":{"id":"f420055adaed7264","repo":"kestra-io/kestra","slug":"provided-query-filters-are-invalid-s","errorCode":null,"errorMessage":"Provided query filters are invalid: %s","messagePattern":"Provided query filters are invalid: (.+?)","errorType":"validation","errorClass":"InvalidQueryFiltersException","httpStatus":400,"severity":"error","filePath":"core/src/main/java/io/kestra/core/models/QueryFilter.java","lineNumber":899,"sourceCode":"        private static Operation toOperation(Op op) {\n            return new Operation(op.name(), op.name());\n        }\n    }\n\n    public record FieldOp(String name, String value, List<Operation> operations) {\n    }\n\n    public record Operation(String name, String value) {\n    }\n\n    public static void validateQueryFilters(List<QueryFilter> filters, Resource resource) {\n        if (filters == null) {\n            return;\n        }\n        List<String> errors = new ArrayList<>();\n        filters.forEach(filter -> collectValidationErrors(filter, resource, errors));\n        if (!errors.isEmpty()) {\n            throw new InvalidQueryFiltersException(errors);\n        }\n    }\n\n    private static void collectValidationErrors(QueryFilter filter, Resource resource, List<String> errors) {\n        if (filter.isNode()) {\n            filter.children().forEach(child -> collectValidationErrors(child, resource, errors));\n            return;\n        }\n        if (!resource.supportedOp(filter.field()).contains(filter.operation())) {\n            errors.add(\n                \"Operation %s is not supported for field %s. Supported operations are %s\".formatted(\n                    filter.operation(), filter.field().name(),\n                    resource.supportedOp(filter.field()).stream().map(Op::name).collect(Collectors.joining(\", \"))\n                )\n            );\n        }\n        if (!resource.supportedField().contains(filter.field())) {\n            errors.add(","sourceCodeStart":881,"sourceCodeEnd":917,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/models/QueryFilter.java#L881-L917","documentation":"Thrown by QueryFilter.validateQueryFilters() (wrapped in InvalidQueryFiltersException) when one or more filters reference an operation not supported by the target Resource for the given field. The validator walks each filter (recursing into node children) and collects every mismatch, then throws a single aggregate exception listing all errors. This enforces that only semantically valid filter combinations reach the backend query layer.","triggerScenarios":"Sending an EQUAL_TO operation on a field that only supports STARTS_WITH; using a date range operation on a non-date field; referencing a field that does not exist for the given Resource; mixing filters valid for executions on a logs/dashboards resource.","commonSituations":"Frontend exposes a generic filter UI without checking the resource's supported operations; API consumer copies a filter from one resource to another; a new operation was added to the enum but not to the resource's supportedOp map.","solutions":["Call Resource.supportedOp(field) to discover the valid operations for the target field before building the filter.","Cross-check the field name against the resource's documented supported fields.","If aggregating multiple filters, fix every reported error, not just the first.","Update the client filter builder to constrain operation choices per-field."],"exampleFix":"// before\nfilter: field=startDate, operation=EQUAL_TO\n// InvalidQueryFiltersException: Operation EQUAL_TO not supported for startDate\n\n// after\nfilter: field=startDate, operation=GREATER_THAN, value=\"2025-01-01\"","handlingStrategy":"validation","validationCode":"List<String> errors = new ArrayList<>();\nfilters.forEach(f -> collectValidationErrors(f, resource, errors));\nif (!errors.isEmpty()) {\n    throw new InvalidQueryFiltersException(errors);\n}","typeGuard":null,"tryCatchPattern":"try {\n    QueryFilter.validateQueryFilters(filters, resource);\n} catch (InvalidQueryFiltersException e) {\n    return ResponseEntity.badRequest().body(Map.of(\"errors\", e.getErrors()));\n}","preventionTips":["Query Resource.supportedOp(field) before assembling a filter.","Drive the UI operation selector from the resource's supported operations."],"tags":["query","validation","filter","dashboard","api"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}