pentaho/pentaho-kettle · error · RhinoRuntimeError

The function call createFolder is not valid.

Error message

The function call createFolder is not valid.

What it means

createFolder() throws this when creating the directory raises a java.io.IOException. It is thrown from the inner try block after the existence check, meaning the folder did not exist but its creation failed. The original IOException text is discarded, so only this generic message is shown.

Solutions

  1. Create parent directories first (call createFolder() for each level, or use mkdir -p externally).
  2. Verify the process user has write permission on the parent directory.
  3. Confirm the target path does not conflict with an existing file of the same name.
  4. Check the folder path uses a valid VFS URI.
  5. Catch the error in the JS step and log ArgList[0] to identify the failing path.

Example fix

// before
createFolder('/data/out/2026/09'); // parents missing
// after
createFolder('/data');
createFolder('/data/out');
createFolder('/data/out/2026');
createFolder('/data/out/2026/09');
Defensive patterns

Strategy: validation

Validate before calling

var parent = path.substring(0, path.lastIndexOf('/'));
var pf = new java.io.File(parent);
if (!pf.exists()) { createFolder(parent); } // ensure parents first
createFolder(path);

Try / catch

try { createFolder(path); } catch (e) { Logger.logError('createFolder failed for ' + path + ': ' + e.message); }

Prevention

When it happens

Trigger: fileObject.createFolder() fails: parent directory missing, insufficient write permission on parent, path is an existing non-directory, or the VFS URL is malformed such that resolution succeeds but creation fails.

Common situations: Creating nested folders whose parent does not exist (no mkdirs semantics); writing to a read-only mount; permission denied on shared/network drives; typo in scheme causing wrong provider.

Understand the failure class

Background: mkdir permission denied (EACCES): failed to create directory errors explained — this error's family across 32 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:2092

    }
  }

  public static void createFolder( Context actualContext, Scriptable actualObject, Object[] ArgList,
    Function FunctionContext ) {

    try {
      if ( ArgList.length == 1 && !isNull( ArgList[0] ) && !isUndefined( ArgList[0] ) ) {
        FileObject fileObject = null;

        try {
          fileObject = KettleVFS.getInstance( getBowl( actualObject ) ).getFileObject( Context.toString( ArgList[0] ) );
          if ( !fileObject.exists() ) {
            fileObject.createFolder();
          } else {
            Context.reportRuntimeError( "folder [" + Context.toString( ArgList[0] ) + "] already exist!" );
          }
        } catch ( IOException e ) {
          throw Context.reportRuntimeError( "The function call createFolder is not valid." );
        } finally {
          if ( fileObject != null ) {
            try {
              fileObject.close();
            } catch ( Exception e ) {
              // Ignore errors
            }
          }
        }

      } else {
        throw Context.reportRuntimeError( "The function call createFolder is not valid." );
      }
    } catch ( Exception e ) {
      throw Context.reportRuntimeError( e.toString() );
    }
  }

View on GitHub (pinned to f3058517a1)