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
- Use one of the supported values: default or cluster.
- Trim values sourced from files/env before passing: setTableMethod(value.trim()).
- 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
- Always trim values coming from env/config files before passing to setters.
- Prefer the isValid* static validators over try/catch for user-facing input.
- Drive allowed values from the library's own getXxxOptions(...) so you never drift from the registered set.
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
- Unsupported reading order '%s'. Supported values: %s
- Unsupported image output mode '%s'. Supported values: %s
- Unsupported image format '%s'. Supported values: %s
- Invalid page range format: '%s'. Expected format: 1,3,5-7
- Page numbers must be positive: '%s'
AI-assisted analysis of opendataloader-project/opendataloader-pdf@a7789b8e77 (2026-08-14).
Data as JSON: /api/errors/d1202b4900eb5cf6.
Report an issue: GitHub.