{"record":{"id":"4441adb08ba09ac7","repo":"spring-projects/spring-boot","slug":"s-is-not-within-the-valid-range-s-to-s","errorCode":null,"errorMessage":"'%s' is not within the valid range %s to %s","messagePattern":"'(.+?)' is not within the valid range (.+?) to (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/MavenBuildOutputTimestamp.java","lineNumber":92,"sourceCode":"\t * @return the parsed timestamp as an {@code Instant}, or {@code null}\n\t * @throws IllegalArgumentException if the outputTimestamp is neither ISO 8601 nor an\n\t * integer, or it's not within the valid range 1980-01-01T00:00:02Z to\n\t * 2099-12-31T23:59:59Z\n\t */\n\t@Nullable Instant toInstant() {\n\t\tif (!StringUtils.hasLength(this.timestamp)) {\n\t\t\treturn null;\n\t\t}\n\t\tif (isNumeric(this.timestamp)) {\n\t\t\treturn Instant.ofEpochSecond(Long.parseLong(this.timestamp));\n\t\t}\n\t\tif (this.timestamp.length() < 2) {\n\t\t\treturn null;\n\t\t}\n\t\ttry {\n\t\t\tInstant instant = OffsetDateTime.parse(this.timestamp).withOffsetSameInstant(ZoneOffset.UTC).toInstant();\n\t\t\tif (instant.isBefore(DATE_MIN) || instant.isAfter(DATE_MAX)) {\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\tString.format(\"'%s' is not within the valid range %s to %s\", instant, DATE_MIN, DATE_MAX));\n\t\t\t}\n\t\t\treturn instant;\n\t\t}\n\t\tcatch (DateTimeParseException pe) {\n\t\t\tthrow new IllegalArgumentException(String.format(\"Can't parse '%s' to instant\", this.timestamp));\n\t\t}\n\t}\n\n\tprivate static boolean isNumeric(String str) {\n\t\tfor (char c : str.toCharArray()) {\n\t\t\tif (!Character.isDigit(c)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/270dfe353fb830fd69b823a8a859287ff103854b/build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/MavenBuildOutputTimestamp.java#L74-L110","documentation":"IllegalArgumentException thrown by MavenBuildOutputTimestamp.toFileTime's parse branch when the supplied ISO-8601 timestamp parses successfully but resolves to an Instant outside the permitted [DATE_MIN, DATE_MAX] window. The bound exists because Reproducible Builds requires a sane epoch range and extreme values would corrupt jar entries.","triggerScenarios":"Setting <project.build.outputTimestamp> (or the plugin's <outputTimestamp>) to an ISO-8601 string that is earlier than DATE_MIN or later than DATE_MAX after conversion to UTC.","commonSituations":"Using a CI-injected timestamp like '1970-01-01T00:00:00Z' that predates DATE_MIN; misconfigured SOURCE_DATE_EPOCH rollover producing a far-future date; copy-pasting a timestamp from a different timezone that shifts out of range.","solutions":["Set <project.build.outputTimestamp> to a value within the documented reproducible-builds window (typically after 1980).","Use the epoch-seconds numeric form for deterministic builds, e.g. <outputTimestamp>1700000000</outputTimestamp>.","Omit the property entirely (null/empty returns null from toFileTime) if reproducible timestamps aren't required.","Check the SOURCE_DATE_EPOCH environment variable feeding the timestamp."],"exampleFix":"// before: <project.build.outputTimestamp>1970-01-01T00:00:00Z</project.build.outputTimestamp>\n// after:  <project.build.outputTimestamp>2024-01-01T00:00:00Z</project.build.outputTimestamp>","handlingStrategy":"validation","validationCode":"// Validate the outputTimestamp window before repackage/build-image:\nInstant t = OffsetDateTime.parse(outputTimestamp).withOffsetSameInstant(ZoneOffset.UTC).toInstant();\nif (t.isBefore(DATE_MIN) || t.isAfter(DATE_MAX)) {\n    throw new IllegalArgumentException(outputTimestamp + \" outside \" + DATE_MIN + \"..\" + DATE_MAX);\n}","typeGuard":null,"tryCatchPattern":"try {\n    // invoke goal that calls toFileTime\n} catch (IllegalArgumentException ex) {\n    if (ex.getMessage().contains(\"not within the valid range\")) {\n        // move outputTimestamp inside the window and retry\n    }\n    throw ex;\n}","preventionTips":["Use epoch seconds for deterministic builds to skip the ISO path entirely.","Validate SOURCE_DATE_EPOCH before passing it as outputTimestamp.","Document the allowed window for your CI-generated timestamps."],"tags":["spring-boot","maven-plugin","reproducible-builds","timestamp","configuration"],"backgroundTag":null,"analyzedSha":"270dfe353fb830fd69b823a8a859287ff103854b","analyzedAt":"2026-08-11T19:42:06.541Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}