apache/druid · error · IllegalArgumentException
ParametrizedUriExtractor with pattern
Error message
ParametrizedUriExtractor with pattern %s requires %s to be set in event, but found %s
What it means
ParametrizedUriExtractor builds the target URI by substituting placeholders in a URI pattern with values from the event map. If any required placeholder key is absent (or null) in the event, apply() throws IllegalArgumentException naming the pattern, the missing key, and the event map. It is a per-event data validation failure inside the emitter framework.
Solutions
- Ensure emitted events contain all keys referenced by the URI pattern (e.g. set 'feed' on the event).
- Route such events to a different extractor/feed in the SwitchingEmitter config.
- Simplify the URI pattern to only use keys guaranteed on all events.
- Add a null/containsKey check on the event map before emitting to that extractor.
Example fix
// before
ServiceMetricEvent.builder().setMetric("query/time", 10).build(); // no feed
// after
ServiceMetricEvent.builder().setFeed("feed").setMetric("query/time", 10).build(); Defensive patterns
Strategy: validation
Validate before calling
Map<String, Object> eventMap = event.toMap();
for (String key : requiredUriParams) {
if (eventMap.get(key) == null) {
throw new IllegalArgumentException("Event missing required URI param: " + key);
}
} Type guard
boolean hasAllParams(Event event, java.util.List<String> keys) {
Map<String, Object> m = event.toMap();
return keys.stream().allMatch(k -> m.get(k) != null);
} Try / catch
try {
extractor.apply(event);
} catch (IllegalArgumentException e) {
log.error(e, "Event lacks fields required by URI pattern; routing to default feed");
} Prevention
- Match extractor URI params to fields actually set on events
- Set 'feed' (and any other placeholders) on every event
- Route heterogeneous events via SwitchingEmitter to appropriate extractors
When it happens
Trigger: Configuring a parametrized feed URI (e.g. feed pattern containing {feed} or {dataSource}) and emitting an event whose toMap() lacks that key; events of a different type routed to a parametrized feed via SwitchingEmitter.
Common situations: Custom events that don't carry the 'feed' field routed to a ParametrizedUriExtractor; renaming event fields in custom metric emitters; misconfigured emitter JSON where the URI pattern expects fields only some events have.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- A local input source requires one property of
- An inline input source must provide a format.
- An inline input source must provide one or more columns
- Column must have a name
- Column name is required
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/5bbb6eaf9f819dc8.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/java/util/emitter/core/ParametrizedUriExtractor.java:61
while (keyMatcher.find()) {
params.add(keyMatcher.group(1));
}
}
public Set<String> getParams()
{
return params;
}
@Override
public URI apply(Event event) throws URISyntaxException
{
Map<String, Object> eventMap = event.toMap();
String processedUri = uriPattern;
for (String key : params) {
Object paramValue = eventMap.get(key);
if (paramValue == null) {
throw new IAE(
"ParametrizedUriExtractor with pattern %s requires %s to be set in event, but found %s",
uriPattern,
key,
eventMap
);
}
processedUri = StringUtils.replace(processedUri, StringUtils.format("{%s}", key), paramValue.toString());
}
return new URI(processedUri);
}
@Override
public String toString()
{
return "ParametrizedUriExtractor{" +
"uriPattern='" + uriPattern + '\'' +
", params=" + params +
'}';View on GitHub (pinned to 9b90983fd2)