{"record":{"id":"3d862a759754af92","repo":"apache/druid","slug":"time-chunk-s-provided-in-replacetimechunks-is-n","errorCode":null,"errorMessage":"Time chunk [%s] provided in replaceTimeChunks is not aligned with segmentGranularity [%s]","messagePattern":"Time chunk \\[(.+?)\\] provided in replaceTimeChunks is not aligned with segmentGranularity \\[(.+?)\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"multi-stage-query/src/main/java/org/apache/druid/msq/indexing/destination/DataSourceMSQDestination.java","lineNumber":292,"sourceCode":"      // Verify that if replaceTimeChunks is provided, it is nonempty.\n      if (replaceTimeChunks.isEmpty()) {\n        throw new IAE(\"replaceTimeChunks must be null or nonempty; cannot be empty\");\n      }\n\n      // Verify all provided time chunks are aligned with segmentGranularity.\n      for (final Interval interval : replaceTimeChunks) {\n        // ETERNITY gets a free pass.\n        if (!Intervals.ETERNITY.equals(interval)) {\n          final boolean startIsAligned =\n              segmentGranularity.bucketStart(interval.getStart()).equals(interval.getStart());\n\n          final boolean endIsAligned =\n              segmentGranularity.bucketStart(interval.getEnd()).equals(interval.getEnd())\n              || segmentGranularity.increment(segmentGranularity.bucketStart(interval.getEnd()))\n                                   .equals(interval.getEnd());\n\n          if (!startIsAligned || !endIsAligned) {\n            throw new IAE(\n                \"Time chunk [%s] provided in replaceTimeChunks is not aligned with segmentGranularity [%s]\",\n                interval,\n                segmentGranularity\n            );\n          }\n        }\n      }\n    }\n  }\n}\n","sourceCodeStart":274,"sourceCodeEnd":303,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/multi-stage-query/src/main/java/org/apache/druid/msq/indexing/destination/DataSourceMSQDestination.java#L274-L303","documentation":"Validation in validateReplaceTimeChunksGranularityAligned: each interval in replaceTimeChunks must start and end on boundaries of the query's segmentGranularity so the engine can map chunks onto segments cleanly. ETERNITY is exempted. An unaligned interval means the user supplied chunk boundaries that don't line up with segmentGranularity buckets.","triggerScenarios":"Thrown at multi-stage-query/src/main/java/org/apache/druid/msq/indexing/destination/DataSourceMSQDestination.java:292 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Adjust replaceTimeChunks intervals to exact multiples of segmentGranularity (e.g. with segmentGranularity=day, use day-aligned intervals).","Simplify to replaceTimeChunks = ETERNITY ('1970-01-01T00:00:00Z/P1000Y') to replace all data.","Re-check the SQL generated by the client/tool; misaligned intervals often come from manual SQL edits."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}