apache/seatunnel · error · PrometheusConnectorException

CommonErrorCode.UNSUPPORTED_METHOD

CommonErrorCode.UNSUPPORTED_METHOD

Error message

unsupported query type

What it means

PrometheusSourceReader.collect converts query results based on the configured query type (Range or Instant); an unknown QueryType falls through the switch default and throws UNSUPPORTED_METHOD with 'unsupported query type'.

Solutions

  1. Set query_type to a supported value (Range or Instant)
  2. Fix spelling/casing of the query_type config value
  3. Check the connector docs for currently supported query types
  4. Upgrade the connector if your config predates the current enum

Example fix

// before
query_type = "range_query"
// after
query_type = "Range"
Defensive patterns

Strategy: validation

Validate before calling

String qt = config.getString("query_type");
if (!"Range".equals(qt) && !"Instant".equals(qt)) throw new IllegalArgumentException("query_type must be Range or Instant, got: " + qt);

Type guard

boolean isSupportedQueryType(String qt) { return "Range".equals(qt) || "Instant".equals(qt); }

Try / catch

try { reader.pollAndCollectData(); } catch (PrometheusConnectorException e) { if (CommonErrorCode.UNSUPPORTED_METHOD.equals(e.getErrorCode())) { LOG.error("Invalid query_type config"); } throw e; }

Prevention

When it happens

Trigger: The source's configured query type value resolves to something other than the supported Range/Instant enum values.

Common situations: Misspelled query_type in config (e.g. 'range_query' or 'instant_query' instead of Range/Instant); case-sensitivity issues; config from an older connector version with different enum names.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/b2e865969f0e988b. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-prometheus/src/main/java/org/apache/seatunnel/connectors/seatunnel/prometheus/source/PrometheusSourceReader.java:128

                    Thread.sleep(httpParameter.getPollIntervalMillis());
                }
            }
        }
    }

    private void collect(Collector<SeaTunnelRow> output, String data) throws IOException {
        if (contentJson != null) {
            data = JsonUtils.stringToJsonNode(getPartOfJson(data)).toString();
        }
        switch (queryType) {
            case Range:
                convertRangePoints(data, output);
                break;
            case Instant:
                convertInstantPoints(data, output);
                break;
            default:
                throw new PrometheusConnectorException(
                        CommonErrorCode.UNSUPPORTED_METHOD, "unsupported query type");
        }
    }

    private void convertRangePoints(String data, Collector<SeaTunnelRow> output) {
        List<RangePoint> rangePoints = JsonUtils.toList(data, RangePoint.class);
        if (CollectionUtils.isEmpty(rangePoints)) {
            return;
        }
        rangePoints.forEach(
                rangePoint -> {
                    Map<String, String> metric = rangePoint.getMetric();
                    rangePoint
                            .getValues()
                            .forEach(
                                    value -> {
                                        double timestampDouble =
                                                Double.valueOf(String.valueOf(value.get(0)));

View on GitHub (pinned to cf67b549a7)