pentaho/pentaho-kettle · error · IllegalArgumentException
S3FileOutput.Error.InvalidRegex
Error message
S3FileOutput.Error.InvalidRegex
What it means
S3FileOutputHelper.fileMatchesFilter compiles the user-supplied filename filter string as a Java regex and rethrows PatternSyntaxException as IllegalArgumentException with the localized message 'S3FileOutput.Error.InvalidRegex' plus the regex engine's description. It exists to surface a bad user-entered filter pattern with a clear message instead of a raw regex stack trace.
Solutions
- Read e.getDescription() in the message and fix the regex at that position (balance parentheses/brackets, escape special chars).
- Escape literal characters (e.g. use \. for a dot) or use Pattern.quote() around literal text.
- If users need glob semantics, translate globs to regex (.* for *, . for ?) before compiling.
- Validate the pattern with Pattern.compile() in the dialog before running the transformation.
Example fix
// before Matcher matcher = Pattern.compile( filter ).matcher( file ); // after: accept simple glob input String regex = filter.replace( ".", "\\." ).replace( "*", ".*" ).replace( "?", "." ); Matcher matcher = Pattern.compile( regex ).matcher( file );
Defensive patterns
Strategy: validation
Validate before calling
// validate user filter before use
try {
java.util.regex.Pattern.compile( filter );
} catch ( java.util.regex.PatternSyntaxException pse ) {
throw new IllegalArgumentException( "Invalid filter regex at pos " + pse.getIndex() + ": " + pse.getDescription() );
} Prevention
- Escape regex metacharacters in literal filename filters (Pattern.quote)
- Convert user globs (*, ?) to regex explicitly
- Validate patterns in the UI dialog before running
- Test filters against sample filenames
When it happens
Trigger: showFilesAction -> fileMatchesFilter with a filter string that is not a valid Java regular expression, e.g. unbalanced '(' or '[', trailing backslash, or a dangling quantifier like '*csv'.
Common situations: User types a Windows-style glob with special characters in the S3 File Output filter field; copy-pasted globs with unmatched braces or brackets; filenames containing special regex characters treated as patterns.
Related errors
- RegexEval.Exception.ErrorCaptureGroupFieldsMismatch
- RegexEval.Exception.ErrorMatcherMissing
- RegexEval.Exception.ErrorResultFieldMissing
- A connection of type PALO is expected
- A connection of type PALO is expected
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/08025933dde20b7e.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/s3-vfs/core/src/main/java/org/pentaho/amazon/s3/S3FileOutputHelper.java:214
if ( fileMatchesFilter( file, filter, isRegex ) ) {
filteredFiles.add( file );
}
}
response.put( FILES_KEY, filteredFiles );
return response;
}
// Checks if file path matches filter criteria (regex or case-insensitive substring)
private boolean fileMatchesFilter( String file, String filter, String isRegex ) {
if ( Boolean.parseBoolean( isRegex ) ) {
if ( S3Util.isEmpty( filter ) ) {
return true;
}
try {
Matcher matcher = Pattern.compile( filter ).matcher( file );
return matcher.matches();
} catch ( PatternSyntaxException e ) {
throw new IllegalArgumentException(
BaseMessages.getString(
PKG,
"S3FileOutput.Error.InvalidRegex"
) + ": " + e.getDescription(),
e
);
}
} else {
return S3Util.isEmpty( filter ) || StringUtils.containsIgnoreCase( file, filter );
}
}
@SuppressWarnings( "unchecked" )
public JSONObject listS3BucketsAction( TransMeta transMeta, Map<String, String> queryParams ) {
JSONObject response = new JSONObject();
JSONArray buckets = new JSONArray();
try {
S3Details s3Details = createS3DetailsFromParams( transMeta, queryParams );View on GitHub (pinned to f3058517a1)