apache/dolphinscheduler · error · IllegalArgumentException

datasource other params: + entry.getKey() + illegal

Error message

datasource other params: + entry.getKey() + illegal

What it means

Generic validation guard in AbstractDataSourceProcessor.checkOther: fires when an entry key in the datasource 'other' params map does not match PARAMS_PATTER — the offending extra-connection-parameter key (entry.getKey(), embedded in the message) contains characters outside the allowed pattern. A sibling check rejects keys in POSSIBLE_MALICIOUS_KEYS to prevent JDBC-url injection.

Source

Thrown at dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDataSourceProcessor.java:105

    }

    /**
     * check other is valid
     *
     * @param other other
     */
    protected void checkOther(Map<String, String> other) {
        if (MapUtils.isEmpty(other)) {
            return;
        }

        if (!Sets.intersection(other.keySet(), POSSIBLE_MALICIOUS_KEYS).isEmpty()) {
            throw new IllegalArgumentException("Other params include possible malicious keys.");
        }

        for (Map.Entry<String, String> entry : other.entrySet()) {
            if (!PARAMS_PATTER.matcher(entry.getKey()).matches()) {
                throw new IllegalArgumentException("datasource other params: " + entry.getKey() + " illegal");
            }
        }
    }

    protected Map<String, String> transformOtherParamToMap(String other) {
        if (StringUtils.isBlank(other)) {
            return Collections.emptyMap();
        }
        return JSONUtils.parseObject(other, new TypeReference<Map<String, String>>() {
        });
    }

    @Override
    public String getDatasourceUniqueId(ConnectionParam connectionParam, DbType dbType) {
        BaseConnectionParam baseConnectionParam = (BaseConnectionParam) connectionParam;
        return MessageFormat.format("{0}@{1}@{2}@{3}", dbType.getName(), baseConnectionParam.getUser(),
                PasswordUtils.encodePassword(baseConnectionParam.getPassword()), baseConnectionParam.getJdbcUrl());
    }

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Rename the param key to match PARAMS_PATTER (word characters only)
  2. Verify the other params JSON parses and keys are clean identifiers
  3. Move non-identifier options to the JDBC URL instead

Example fix

// before
{"connect.timeout":"5000"}
// after
{"connectTimeout":"5000"}
Defensive patterns

Strategy: validation

Validate before calling

boolean keysOk = other == null || other.keySet().stream().allMatch(k -> k.matches("^[a-zA-Z0-9_]+$"));

Try / catch

try { processor.checkDatasourceParam(dto); } catch (IllegalArgumentException e) { /* e.getMessage() names the illegal key */ }

Prevention

When it happens

Trigger: Other params JSON with keys containing spaces, slashes, special characters, or empty keys.

Common situations: Malformed JSON keys, keys with dashes or dots pasted from vendor docs, accidentally duplicated header text as a key.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/e110c27f20946dc8. Report an issue: GitHub.