pentaho/pentaho-kettle · error · FileNotFoundException

package file could not be found for file in folder

Error message

package file could not be found for file in folder 

What it means

MessagesStore.getLoadFilename() throws FileNotFoundException when it cannot locate messages_<locale>.properties for the requested messages package in the primary source folder or any of the alternativeSourceFolders. The Translator needs the physical file to read/write translations; without one there is nothing to load.

Solutions

  1. Verify the derived path (sourceFolder + package-as-path + messages_<locale>.properties) actually exists; create the missing properties file if this locale is new.
  2. Add the correct project root to the Translator's alternative source folders or fix the configured source folder.
  3. Check the locale spelling/variant matches an existing file name exactly.
  4. Confirm package name matches the directory structure (dots -> slashes).

Example fix

// before
// configured source folder: /projects/pdi (UI files live in ui/)
store.read(); // FileNotFoundException

// after
// configure folders to include the module that owns the package
List<String> folders = Arrays.asList( "/projects/pdi/ui/src", "/projects/pdi/core/src" );
store = new MessagesStore( locale, messagesPackage, props, folders );
store.read();
Defensive patterns

Strategy: validation

Validate before calling

String path = sourceFolder + "/" + messagesPackage.replace( '.', '/' ) + "/messages_" + locale + ".properties";
if ( !new File( path ).exists() ) {
  throw new IllegalStateException( "Expected messages file missing: " + path );
}

Try / catch

try {
  store.read();
} catch ( KettleException e ) {
  if ( e.getCause() instanceof FileNotFoundException ) {
    log.error( "Locale file absent in all configured folders; check folders/locale/package", e );
  } else { throw e; }
}

Prevention

When it happens

Trigger: read() asks for a locale/package combination whose file exists in none of the configured source folders — wrong locale code, wrong package-to-path mapping (package dots converted to path segments), or the folder simply doesn't exist on disk.

Common situations: Pointing the Translator at the wrong root source folder (e.g. the UI project vs core); requesting a locale file that was never created (e.g. messages_nn.properties); packages renamed after a refactoring so the derived path no longer exists.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/d51567436827c643. Report an issue: GitHub.

Appendix: source

Thrown at ui/src/main/java/org/pentaho/di/ui/i18n/MessagesStore.java:176

   */
  public String getLoadFilename( List<String> alternativeSourceFolders ) throws FileNotFoundException {
    String path = calcFolderName( sourceFolder );

    // First try the source folder of the Java file
    //
    if ( new File( path ).exists() ) {
      return path;
    }

    // Then try the rest of the project source folders in order of occurrence ..
    //
    for ( String altSourceFolder : alternativeSourceFolders ) {
      path = calcFolderName( altSourceFolder );
      if ( new File( path ).exists() ) {
        return path;
      }
    }
    throw new FileNotFoundException( "package file could not be found for file in folder "
      + sourceFolder + ", with messages package " + messagesPackage + " in locale " + locale );
  }

  private String calcFolderName( String sourceFolderPath ) {
    String localeUpperLower = locale.substring( 0, 3 ).toLowerCase() + locale.substring( 3 ).toUpperCase();
    String filename = "messages_" + localeUpperLower + ".properties";
    String path =
      sourceFolderPath
        + File.separator + messagesPackage.replace( '.', '/' ) + File.separator + "messages" + File.separator
        + filename;
    return path;
  }

  public String getSourceDirectory( List<String> directories ) {
    String localeUpperLower = locale.substring( 0, 3 ).toLowerCase() + locale.substring( 3 ).toUpperCase();

    String filename = "messages_" + localeUpperLower + ".properties";
    String path = messagesPackage.replace( '.', '/' );

View on GitHub (pinned to f3058517a1)