t8y2/dbx · error · IllegalArgumentException

is required.

Error message

 is required.

What it means

requireText is a request-validation helper: it reads a text field from the incoming RPC JSON node and throws IllegalArgumentException("<field> is required.") when the field is absent, null, or blank. The odd trailing-space message comes from the concatenation field + " is required.", so the actual missing field name prefixes the message. It is a fail-fast guard ensuring mandatory RPC parameters are present before any work is done.

Source

Thrown at plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java:4499

                node.putNull(field);
            }
            return;
        }
        node.put(field, value);
    }

    private static void putNullableInt(ObjectNode node, String field, Object value) {
        if (value instanceof Number number) {
            node.put(field, number.intValue());
        } else {
            node.putNull(field);
        }
    }

    private static String requireText(JsonNode node, String field) {
        String value = optionalText(node, field);
        if (value == null) {
            throw new IllegalArgumentException(field + " is required.");
        }
        return value;
    }

    private static String optionalText(JsonNode node, String field) {
        JsonNode value = node.path(field);
        if (value.isMissingNode() || value.isNull()) {
            return null;
        }
        String text = value.asText("").trim();
        return text.isEmpty() ? null : text;
    }

    private static List<String> optionalStringList(JsonNode node, String field) {
        JsonNode value = node.path(field);
        if (value.isMissingNode() || value.isNull()) {
            return null;
        }

View on GitHub (pinned to c0390bff16)

Solutions

  1. Include the field named in the message (everything before " is required.") in the request JSON
  2. Check exact key casing against the plugin's RPC schema/docs
  3. Send a non-empty string, not "" or null
  4. Update the client SDK to match the plugin's expected request shape

Example fix

// before
{ "sql": "SELECT 1" } // -> IllegalArgumentException("connection is required.")
// after
{ "connection": { "url": "jdbc:..." }, "sql": "SELECT 1" }
Defensive patterns

Strategy: validation

Validate before calling

static void requireField(Map<String,Object> req, String field) {
    Object v = req.get(field);
    if (v == null || (v instanceof String s && s.isBlank())) {
        throw new IllegalArgumentException(field + " is required.");
    }
}
requireField(request, "connection"); requireField(request, "sql");

Type guard

static boolean hasTextField(JsonNode node, String field) {
    return node.hasNonNull(field) && node.get(field).isTextual() && !node.get(field).asText().isBlank();
}

Try / catch

try {
    return rpc.call(request);
} catch (IllegalArgumentException e) {
    if (e.getMessage() != null && e.getMessage().endsWith(" is required.")) {
        String missing = e.getMessage().replace(" is required.", "");
        throw new BadRequestException("Missing request field: " + missing);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling any plugin RPC (query, browse, object-source, etc.) without a mandatory field such as "connection", "sql", "name", or "objectType" in the request JSON.

Common situations: Client omits optional-looking fields the server treats as mandatory; JSON key casing mismatch ("Database" vs "database"); empty string sent instead of a real value; API contract drift between client and plugin versions.

Understand the failure class

Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/83ea82babb452845. Report an issue: GitHub.