apache/druid · info
Segment id [ ] is unknown
Error message
Segment id [%s] is unknown
What it means
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.
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
Example fix
// before GET /druid/coordinator/v1/datasources/wikipedia/segments/wikipedia_2020-01-01T00:00:00.000Z_2020-02-01T00:00:00.000Z_2020 // after (valid id from segments listing) GET /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
Defensive patterns
Strategy: validation
Validate before calling
final List<String> ids = listSegments(dsName); if (!ids.contains(segmentId)) { skip lookup; } Type guard
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]+$ Try / catch
final Response r = client.target(segUrl).request().get(); if (r.getStatus() == 204) { LOG.info("segment {} unknown; skipping", segmentId); return Optional.empty(); } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Cannot find any supervisor with id
- Cannot find any task with id
- datasource[ ] not found
- No task information found for task with id
- Query [ ] was not found. The query details are no longer…
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/9974dbb297b01a08.
Report an issue: GitHub.
Appendix: source
Thrown at server/src/main/java/org/apache/druid/server/http/DataSourcesResource.java:654
@Produces(MediaType.APPLICATION_JSON)
@ResourceFilters(DatasourceResourceFilter.class)
public Response getServedSegment(
@PathParam("dataSourceName") String dataSourceName,
@PathParam("segmentId") String segmentId
)
{
ImmutableDruidDataSource dataSource = getQueryableDataSource(dataSourceName);
if (dataSource == null) {
return logAndCreateDataSourceNotFoundResponse(dataSourceName);
}
for (SegmentId possibleSegmentId : SegmentId.iteratePossibleParsingsWithDataSource(dataSourceName, segmentId)) {
Pair<DataSegment, Set<String>> retVal = getServersWhereSegmentIsServed(possibleSegmentId);
if (retVal != null) {
return Response.ok(ImmutableMap.of("metadata", retVal.lhs, "servers", retVal.rhs)).build();
}
}
log.warn("Segment id [%s] is unknown", segmentId);
return Response.noContent().build();
}
/**
* @deprecated Use {@code OverlordDataSourcesResource#markSegmentAsUnused} instead.
*/
@Deprecated
@DELETE
@Path("/{dataSourceName}/segments/{segmentId}")
@Produces(MediaType.APPLICATION_JSON)
@ResourceFilters(DatasourceResourceFilter.class)
public Response markSegmentAsUnused(
@PathParam("dataSourceName") String dataSourceName,
@PathParam("segmentId") String segmentIdString
)
{
final SegmentId segmentId = SegmentId.tryParse(dataSourceName, segmentIdString);
if (segmentId == null) {View on GitHub (pinned to 9b90983fd2)