{"record":{"id":"9974dbb297b01a08","repo":"apache/druid","slug":"segment-id-s-is-unknown","errorCode":null,"errorMessage":"Segment id [%s] is unknown","messagePattern":"Segment id \\[(.+?)\\] is unknown","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"server/src/main/java/org/apache/druid/server/http/DataSourcesResource.java","lineNumber":654,"sourceCode":"  @Produces(MediaType.APPLICATION_JSON)\n  @ResourceFilters(DatasourceResourceFilter.class)\n  public Response getServedSegment(\n      @PathParam(\"dataSourceName\") String dataSourceName,\n      @PathParam(\"segmentId\") String segmentId\n  )\n  {\n    ImmutableDruidDataSource dataSource = getQueryableDataSource(dataSourceName);\n    if (dataSource == null) {\n      return logAndCreateDataSourceNotFoundResponse(dataSourceName);\n    }\n\n    for (SegmentId possibleSegmentId : SegmentId.iteratePossibleParsingsWithDataSource(dataSourceName, segmentId)) {\n      Pair<DataSegment, Set<String>> retVal = getServersWhereSegmentIsServed(possibleSegmentId);\n      if (retVal != null) {\n        return Response.ok(ImmutableMap.of(\"metadata\", retVal.lhs, \"servers\", retVal.rhs)).build();\n      }\n    }\n    log.warn(\"Segment id [%s] is unknown\", segmentId);\n    return Response.noContent().build();\n  }\n\n  /**\n   * @deprecated Use {@code OverlordDataSourcesResource#markSegmentAsUnused} instead.\n   */\n  @Deprecated\n  @DELETE\n  @Path(\"/{dataSourceName}/segments/{segmentId}\")\n  @Produces(MediaType.APPLICATION_JSON)\n  @ResourceFilters(DatasourceResourceFilter.class)\n  public Response markSegmentAsUnused(\n      @PathParam(\"dataSourceName\") String dataSourceName,\n      @PathParam(\"segmentId\") String segmentIdString\n  )\n  {\n    final SegmentId segmentId = SegmentId.tryParse(dataSourceName, segmentIdString);\n    if (segmentId == null) {","sourceCodeStart":636,"sourceCodeEnd":672,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/server/http/DataSourcesResource.java#L636-L672","documentation":"GET /druid/coordinator/v1/datasources/{dataSourceName}/segments/{segmentId} looks up the segment by trying all possible parsings of the segment identifier. If no parsing corresponds to a served/known segment, it logs this warning and returns HTTP 204. It means the segment id doesn't match any segment the cluster knows about in that datasource.","triggerScenarios":"getServedSegment() called with a segmentId string that cannot be parsed into a known SegmentId for the datasource — misspelled id, segment already killed, wrong datasource in the path, or segment never loaded.","commonSituations":"Querying for a segment id taken from old logs after it was killed; typos or truncated segment ids in scripts; checking a segment on the wrong coordinator/datasource path.","solutions":["Verify the segment id format `datasource_start_end_version_partition` and the datasource name in the URL","List actual segments via GET /druid/coordinator/v1/datasources/{ds}/segments to get a valid id","Treat HTTP 204 as 'segment not found' and skip rather than retrying"],"exampleFix":"// before\nGET /druid/coordinator/v1/datasources/wikipedia/segments/wikipedia_2020-01-01T00:00:00.000Z_2020-02-01T00:00:00.000Z_2020\n// after (valid id from segments listing)\nGET /druid/coordinator/v1/datasources/wikipedia/segments/wikipedia_2020-01-01T00:00:00.000Z_2020-01-02T00:00:00.000Z_2020-06-01T12:00:00.000Z_1","handlingStrategy":"validation","validationCode":"final List<String> ids = listSegments(dsName); if (!ids.contains(segmentId)) { skip lookup; }","typeGuard":"boolean matchesKnownSegment(String id, Pattern p) { return id != null && p.matcher(id).matches(); } // ^ds_(\\d{4}-\\d{2}-\\d{2}T..Z_){3}[0-9]+$","tryCatchPattern":"final Response r = client.target(segUrl).request().get(); if (r.getStatus() == 204) { LOG.info(\"segment {} unknown; skipping\", segmentId); return Optional.empty(); }","preventionTips":["Copy segment ids from the segments listing endpoint, not from logs","Validate id shape (datasource_start_end_version_partition) before querying","Handle 204 as a definitive not-found"],"tags":["http","rest-api","segment","not-found"],"backgroundTag":"resource-not-found","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"}