opendataloader-project/opendataloader-pdf · error · IllegalArgumentException

Unsupported table method '%s'. Supported values: %s

Error message

Unsupported table method '%s'. Supported values: %s

What it means

Config.setTableMethod rejects any value not in the registered table-method set {default, cluster}. Validation is case-insensitive (the input is lowercased before the contains check), but the setter does NOT trim whitespace, so a value like " cluster" fails. null is accepted and falls back to the default. IllegalArgumentException is thrown before the field is assigned.

Source

Thrown at java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/api/Config.java:425

    /**
     * Gets the table detection method.
     *
     * @return The table detection method (default or cluster).
     */
    public String getTableMethod() {
        return tableMethod;
    }

    /**
     * Sets the table detection method.
     *
     * @param tableMethod The table detection method (default or cluster).
     * @throws IllegalArgumentException if the method is not supported.
     */
    public void setTableMethod(String tableMethod) {
        if (tableMethod != null && !isValidTableMethod(tableMethod)) {
            throw new IllegalArgumentException(
                String.format("Unsupported table method '%s'. Supported values: %s",
                    tableMethod, getTableMethodOptions(", ")));
        }
        this.tableMethod = tableMethod != null ? tableMethod.toLowerCase(Locale.ROOT) : TABLE_METHOD_DEFAULT;
    }

    /**
     * Gets the list of methods of table detection.
     *
     * @param delimiter the delimiter to use between options
     * @return the string with methods separated by the delimiter
     */
    public static String getTableMethodOptions(CharSequence delimiter) {
        return String.join(delimiter, tableMethodOptions);
    }

    /**
     * Checks if the given table method is valid.

View on GitHub (pinned to a7789b8e77)

Solutions

  1. Use one of the supported values: default or cluster.
  2. Trim values sourced from files/env before passing: setTableMethod(value.trim()).
  3. Pre-validate with Config.isValidTableMethod(value) before calling setTableMethod.

Example fix

// before: config.setTableMethod("fast");
// after:  config.setTableMethod("cluster");
Defensive patterns

Strategy: validation

Validate before calling

String method = externalValue == null ? null : externalValue.trim();
if (method != null && !Config.isValidTableMethod(method)) {
    throw new IllegalArgumentException(
        "Bad --table-method '" + method + "'. Valid: " + Config.getTableMethodOptions(", "));
}
config.setTableMethod(method);

Type guard

static boolean isSupportedTableMethod(String s) {
    return s != null && Config.isValidTableMethod(s.trim());
}

Try / catch

try {
    config.setTableMethod(raw);
} catch (IllegalArgumentException e) {
    // fall back to default, or report to the user with getTableMethodOptions(", ")
    config.setTableMethod(null);
}

Prevention

When it happens

Trigger: config.setTableMethod("fast") or CLI --table-method foo. Also fires for untrimmed whitespace-padded values coming from an external JSON/env source.

Common situations: Typo at the command line; value read from a config file written for a different library version; copy-paste of a value name from a different tool; trailing whitespace from templated config injection.

Related errors


AI-assisted analysis of opendataloader-project/opendataloader-pdf@a7789b8e77 (2026-08-14). Data as JSON: /api/errors/d1202b4900eb5cf6. Report an issue: GitHub.