pentaho/pentaho-kettle · error · MissingResourceException
Format problem with key=
Error message
Format problem with key=[${key}], locale=[${locale}], package=${packageName} : ${e} What it means
calculateString formats a message-bundle entry with MessageFormat; if the pattern is malformed or arguments don't match placeholders, MessageFormat throws IllegalArgumentException, which is converted into a MissingResourceException carrying 'Format problem with key=[key], locale=[locale], package=packageName'. The bundle exists but its template cannot be formatted with the supplied arguments.
Solutions
- Inspect the properties file entry for the key in the reported locale/package; fix the MessageFormat pattern (escape quotes as '', verify {0},{1} indices).
- Match the argument count/types to the placeholders in the message template.
- Test the key with the default English bundle to isolate locale-specific breakage.
- Catch MissingResourceException around getString calls for user-supplied/custom bundles.
Example fix
// broken properties entry
MyApp.Error=Can't open file {0} for {1,number}
// fixed
MyApp.Error=Can''t open file {0} for record {1}
// and call: BaseMessages.getString(PKG, "MyApp.Error", fileName, recordId); Defensive patterns
Strategy: try-catch
Validate before calling
try {
new java.text.MessageFormat(bundle.getString(key), locale).format(args);
} catch (IllegalArgumentException e) { /* bad pattern or args */ } Try / catch
try {
msg = BaseMessages.getString(PKG, key, args);
} catch (MissingResourceException e) {
log.error("Bad message pattern for " + key + ": " + e.getMessage());
msg = key; // safe fallback
} Prevention
- Escape single quotes as '' in MessageFormat templates
- Keep placeholder indices/types in sync with call-site arguments
- Lint custom translations with MessageFormat.format in unit tests
When it happens
Trigger: BaseMessages.getString(PKG, key, args...) where the properties entry has a malformed {0} pattern (unclosed brace, bad format type) or the argument types mismatch (e.g. passing a String where {0,number} expects a Number) for the resolved locale.
Common situations: Custom-translated properties files with broken MessageFormat syntax, passing wrong number/type of substitution arguments, locale-specific pattern differences, single quotes in messages not escaped ('' needed) breaking placeholders.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- i18n.Log.UnableToGetFiles
- package file could not be found for file in folder
- [pentaho/i18n!] Bundle path argument cannot be a single '/'.
- [pentaho/messages!] Bundle path argument cannot be a single…
- [pentaho/messages!] Bundle path argument cannot be a single…
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/5e43f3ecee775219.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/i18n/GlobalMessageUtil.java:273
return calculateString( packageName, locale, key, parameters, resourceClass, bundleName, true );
}
@VisibleForTesting
static String calculateString( final String packageName, final Locale locale, final String key,
final Object[] parameters, final Class<?> resourceClass, final String bundleName,
final boolean fallbackOnRoot ) throws MissingResourceException {
try {
ResourceBundle bundle = getBundle( locale, packageName + "." + bundleName, resourceClass, fallbackOnRoot );
String unformattedString = bundle.getString( key );
String string = MessageFormat.format( unformattedString, parameters );
return string;
} catch ( IllegalArgumentException e ) {
final StringBuilder msg = new StringBuilder();
msg.append( "Format problem with key=[" ).append( key ).append( "], locale=[" ).append( locale ).append(
"], package=" ).append( packageName ).append( " : " ).append( e.toString() );
log.error( msg.toString() );
log.error( Const.getStackTracker( e ) );
throw new MissingResourceException( msg.toString(), packageName, key );
}
}
/**
* Retrieve a resource bundle of the default or fail-over locales.
*
* @param packagePath The package to search in
* @param resourceClass the class to use to resolve the bundle
* @return The resource bundle
* @throws MissingResourceException in case both resource bundles couldn't be found.
*/
public static ResourceBundle getBundle( final String packagePath, final Class<?> resourceClass )
throws MissingResourceException {
final Set<Locale> activeLocales = getActiveLocales();
for ( final Locale locale : activeLocales ) {
try {
return getBundle( locale, packagePath, resourceClass );
} catch ( MissingResourceException e ) {View on GitHub (pinned to f3058517a1)