{"record":{"id":"0ff5455b1e9e9de5","repo":"quarkusio/quarkus","slug":"java-time-instant-types-must-not-be-annotated-wi","errorCode":null,"errorMessage":"'java.time.Instant' types must not be annotated with '@DateFormat'","messagePattern":"'java\\.time\\.Instant' types must not be annotated with '@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":619,"sourceCode":"        String dateTimeFormatterProviderClassName = null;\n\n        AnnotationInstance dateFormatInstance = parameterAnnotations.get(DATE_FORMAT);\n\n        if (dateFormatInstance != null) {\n            AnnotationValue formatValue = dateFormatInstance.value(\"pattern\");\n            if (formatValue != null) {\n                format = formatValue.asString();\n            }\n\n            AnnotationValue dateTimeFormatterProviderValue = dateFormatInstance.value(\"dateTimeFormatterProvider\");\n            if (dateTimeFormatterProviderValue != null) {\n                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)) {","sourceCodeStart":601,"sourceCodeEnd":637,"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#L601-L637","documentation":"java.time.Instant parameters use a fixed InstantParamConverter based on standard ISO-8601 parsing, so @DateFormat (which configures a DateTimeFormatter) is meaningless for them. If @DateFormat is present on an Instant parameter, determineTemporalConverter throws this RuntimeException at deployment.","triggerScenarios":"@QueryParam(\"since\") @DateFormat(...) Instant since — any Instant parameter/field carrying @DateFormat.","commonSituations":"Copy-pasting a LocalDateTime parameter declaration and changing the type to Instant while keeping @DateFormat; wanting custom offset parsing for Instant.","solutions":["Remove @DateFormat from the Instant parameter; Instant parses its standard ISO-8601 form.","If custom formats are needed, switch to String or LocalDateTime/OffsetDateTime and convert manually.","For stricter validation, accept String, parse with DateTimeFormatter.ISO_INSTANT, and map failures to 400."],"exampleFix":"// before\n@QueryParam(\"since\")\n@DateFormat(format = \"yyyy-MM-dd\")\nInstant since;\n\n// after\n@QueryParam(\"since\")\nInstant since; // ISO-8601 only","handlingStrategy":"validation","validationCode":"for (java.lang.reflect.Field f : Resource.class.getDeclaredFields()) {\n    if (f.getType() == java.time.Instant.class\n        && f.isAnnotationPresent(org.jboss.resteasy.reactive.DateFormat.class)) {\n        throw new IllegalStateException(\"@DateFormat is not allowed on Instant fields: \" + f.getName());\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never combine @DateFormat with Instant.","Remember: Instant always expects ISO-8601.","Grep for @DateFormat near Instant during reviews."],"tags":["resteasy-reactive","quarkus","java-time","instant","dateformat","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-14T00:17:10.932Z"}