apache/druid · error · ParseException
Metric [%s] not whitelisted.
Error message
Metric [%s] not whitelisted.
What it means
After successfully parsing a line-protocol point, parseLineToMap checks the measurement name against a configured whitelist (checkWhitelist). If the metric (measurement) is not on the whitelist, it throws ParseException("Metric [%s] not whitelisted.", measurement). The extension deliberately restricts ingestion to an approved set of measurements.
Source
Thrown at extensions-contrib/influx-extensions/src/main/java/org/apache/druid/data/input/influx/InfluxLineProtocolReader.java:114
InfluxLineProtocolLexer lexer = new InfluxLineProtocolLexer(charStream);
TokenStream tokenStream = new CommonTokenStream(lexer);
InfluxLineProtocolParser parser = new InfluxLineProtocolParser(tokenStream);
List<InfluxLineProtocolParser.LineContext> lines = parser.lines().line();
if (parser.getNumberOfSyntaxErrors() != 0) {
throw new ParseException(input, "Unable to parse line.");
}
if (lines.size() != 1) {
throw new ParseException(input, "Multiple lines present; unable to parse more than one per record.");
}
Map<String, Object> out = new LinkedHashMap<>();
InfluxLineProtocolParser.LineContext line = lines.get(0);
String measurement = parseIdentifier(line.identifier());
if (!checkWhitelist(measurement)) {
throw new ParseException(input, "Metric [%s] not whitelisted.", measurement);
}
out.put(MEASUREMENT_KEY, measurement);
if (line.tag_set() != null) {
line.tag_set().tag_pair().forEach(t -> parseTag(t, out));
}
line.field_set().field_pair().forEach(t -> parseField(t, out));
if (line.timestamp() != null) {
String timestamp = line.timestamp().getText();
parseTimestamp(timestamp, out);
}
return out;
}
private static void parseTag(InfluxLineProtocolParser.Tag_pairContext tag, Map<String, Object> out)
{View on GitHub (pinned to 9b90983fd2)
Solutions
- Add the offending measurement name to the reader's whitelist configuration and restart/redeploy the ingestion spec.
- Verify exact spelling/case of the measurement in the data versus the whitelist entries.
- If broad ingestion is intended, widen the whitelist (or its wildcard settings) to cover the new metrics.
- Filter out non-whitelisted measurements upstream if they are not supposed to be ingested.
Example fix
// before "whitelist": ["cpu"] // after "whitelist": ["cpu", "mem", "disk"]
Defensive patterns
Strategy: validation
Validate before calling
// Check the measurement against the whitelist before ingesting
String measurement = input.substring(0, input.indexOf(',')).split(" ")[0];
if (!whitelist.contains(measurement)) {
throw new IllegalArgumentException("metric not whitelisted: " + measurement);
} Try / catch
try {
return parseLineToMap(input);
} catch (org.apache.druid.java.util.common.parsers.ParseException e) {
if (e.getMessage() != null && e.getMessage().contains("not whitelisted")) {
log.warn("Skipping non-whitelisted metric in record: {}", input);
return null;
}
throw e;
} Prevention
- Keep the reader whitelist in sync with the producer's measurement inventory.
- Match measurement names exactly (case-sensitive) in config.
- Re-audit the whitelist whenever new metrics are added upstream.
- Log rejected measurements to drive whitelist updates instead of silently dropping them.
When it happens
Trigger: Ingesting a record whose measurement name is not present in the whitelist configured for the InfluxLineProtocolReader (e.g. a whitelist containing only "cpu" while the data contains "mem" points).
Common situations: New metrics added by the producer but not added to the reader's whitelist config; case or spelling mismatch between the measurement in the data and the whitelist entry; reusing a reader config from another pipeline with a narrower whitelist.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Unable to parse line.
- Multiple lines present; unable to parse more than one per re
- Invalid format of number: number is null
- Invalid format of number: number is blank
- Invalid format of number: %s. Negative value is not allowed.
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/e2946933339b9d85.
Report an issue: GitHub.