{"record":{"id":"9c5b1d0d23cb56c1","repo":"quarkusio/quarkus","slug":"one-of-format-or-datetimeformatterprovider-mus","errorCode":null,"errorMessage":"One of 'format' or 'dateTimeFormatterProvider' must be set when using '@DateFormat'","messagePattern":"One of 'format' or 'dateTimeFormatterProvider' must be set when using '@DateFormat'","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/ServerEndpointIndexer.java","lineNumber":631,"sourceCode":"                dateTimeFormatterProviderClassName = dateTimeFormatterProviderValue.asClass().name().toString();\n            }\n        }\n\n        if (INSTANT.equals(paramType)) {\n            if (dateFormatInstance != null) {\n                throw new RuntimeException(contextualizeErrorMessage(\n                        \"'java.time.Instant' types must not be annotated with '@DateFormat'\",\n                        currentMethodInfo));\n            }\n            return new InstantParamConverter.Supplier();\n        }\n\n        if ((format != null) && (dateTimeFormatterProviderClassName != null)) {\n            throw new RuntimeException(contextualizeErrorMessage(\n                    \"Using both 'format' and 'dateTimeFormatterProvider' is not allowed when using '@DateFormat'\",\n                    currentMethodInfo));\n        } else if ((format == null) && (dateTimeFormatterProviderClassName == null) && (dateFormatInstance != null)) {\n            throw new RuntimeException(contextualizeErrorMessage(\n                    \"One of 'format' or 'dateTimeFormatterProvider' must be set when using '@DateFormat'\", currentMethodInfo));\n        }\n\n        if (LOCAL_DATE.equals(paramType)) {\n            return new LocalDateParamConverter.Supplier(format, dateTimeFormatterProviderClassName);\n        } else if (LOCAL_DATE_TIME.equals(paramType)) {\n            return new LocalDateTimeParamConverter.Supplier(format, dateTimeFormatterProviderClassName);\n        } else if (LOCAL_TIME.equals(paramType)) {\n            return new LocalTimeParamConverter.Supplier(format, dateTimeFormatterProviderClassName);\n        } else if (OFFSET_DATE_TIME.equals(paramType)) {\n            return new OffsetDateTimeParamConverter.Supplier(format, dateTimeFormatterProviderClassName);\n        } else if (OFFSET_TIME.equals(paramType)) {\n            return new OffsetTimeParamConverter.Supplier(format, dateTimeFormatterProviderClassName);\n        } else if (ZONED_DATE_TIME.equals(paramType)) {\n            return new ZonedDateTimeParamConverter.Supplier(format, dateTimeFormatterProviderClassName);\n        } else if (YEAR.equals(paramType)) {\n            return new YearParamConverter.Supplier(format, dateTimeFormatterProviderClassName);\n        } else if (YEAR_MONTH.equals(paramType)) {","sourceCodeStart":613,"sourceCodeEnd":649,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/ServerEndpointIndexer.java#L613-L649","documentation":"When @DateFormat is present, one of its two formatter sources must be configured: 'format' or 'dateTimeFormatterProvider'. If neither is set, the annotation is inert and RESTEasy Reactive fails deployment with this RuntimeException.","triggerScenarios":"A bare @DateFormat (no attributes) on a LocalDateTime/LocalDate/OffsetDateTime/etc. parameter.","commonSituations":"Adding @DateFormat as a marker assuming defaults; removing the format value during refactoring; template-generated annotations left blank.","solutions":["Set either format = \"pattern\" or dateTimeFormatterProvider = YourProvider.class.","Remove @DateFormat entirely if default ISO parsing is fine.","If a default pattern was intended, set it explicitly."],"exampleFix":"// before\n@DateFormat\n@QueryParam(\"date\")\nLocalDate date;\n\n// after\n@DateFormat(format = \"yyyy-MM-dd\")\n@QueryParam(\"date\")\nLocalDate date;","handlingStrategy":"validation","validationCode":"DateFormat df = field.getAnnotation(DateFormat.class);\nif (df != null && df.format().isEmpty()\n    && (df.dateTimeFormatterProvider() == void.class || df.dateTimeFormatterProvider() == null)) {\n    throw new IllegalStateException(\"@DateFormat requires format or dateTimeFormatterProvider\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never add @DateFormat without configuring an attribute.","Highlight incomplete annotation usage in reviews.","Add a deployment smoke test to CI."],"tags":["resteasy-reactive","quarkus","java-time","dateformat","missing-attribute","deployment-failure"],"backgroundTag":"invalid-dateformat-annotation-usage","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}