{"record":{"id":"5c4ac552951ee898","repo":"pentaho/pentaho-kettle","slug":"an-error-occurred-while-preparing-the-execution-of-a-slave","errorCode":null,"errorMessage":"An error occurred while preparing the execution of a slave transformation: ","messagePattern":"An error occurred while preparing the execution of a slave transformation: ","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/Trans.java","lineNumber":3921,"sourceCode":"            WebResult webResult = WebResult.fromXMLString( masterReply );\n            if ( !webResult.getResult().equalsIgnoreCase( WebResult.STRING_OK ) ) {\n              throw new KettleException(\n                \"An error occurred while preparing the execution of the master transformation: \" + webResult\n                  .getMessage() );\n            }\n          }\n\n          // Prepare the slaves\n          // WG: Should these be threaded like the above initialization?\n          for ( int i = 0; i < slaves.length; i++ ) {\n            TransMeta slaveTrans = transSplitter.getSlaveTransMap().get( slaves[ i ] );\n            String carteObjectId = carteObjectMap.get( slaveTrans );\n            String slaveReply =\n              slaves[ i ].execService( PrepareExecutionTransServlet.CONTEXT_PATH + \"/?name=\" + URLEncoder.encode(\n                slaveTrans.getName(), \"UTF-8\" ) + \"&id=\" + URLEncoder.encode( carteObjectId, \"UTF-8\" ) + \"&xml=Y\" );\n            WebResult webResult = WebResult.fromXMLString( slaveReply );\n            if ( !webResult.getResult().equalsIgnoreCase( WebResult.STRING_OK ) ) {\n              throw new KettleException( \"An error occurred while preparing the execution of a slave transformation: \"\n                + webResult.getMessage() );\n            }\n          }\n        }\n\n        if ( executionConfiguration.isClusterStarting() ) {\n          // Start the master...\n          if ( masterSteps.size() > 0 ) { // If there is something that needs to be done on the master...\n            String carteObjectId = carteObjectMap.get( master );\n            String masterReply =\n              masterServer.execService( StartExecutionTransServlet.CONTEXT_PATH + \"/?name=\" + URLEncoder.encode(\n                master.getName(), \"UTF-8\" ) + \"&id=\" + URLEncoder.encode( carteObjectId, \"UTF-8\" ) + \"&xml=Y\" );\n            WebResult webResult = WebResult.fromXMLString( masterReply );\n            if ( !webResult.getResult().equalsIgnoreCase( WebResult.STRING_OK ) ) {\n              throw new KettleException( \"An error occurred while starting the execution of the master transformation: \"\n                + webResult.getMessage() );\n            }\n          }","sourceCodeStart":3903,"sourceCodeEnd":3939,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/Trans.java#L3903-L3939","documentation":"Thrown by Trans.prepareExecution(String[]) while setting up a clustered transformation: the master asked a slave's Carte servlet (PrepareExecutionTransServlet) to prepare its slice of the transformation, and the slave replied with a WebResult whose result is not 'OK'. The slave-side failure message is appended to this wrapper exception, so the root cause text comes from the remote slave.","triggerScenarios":"Calling Trans.execute/prepareExecution on a clustered (partitioned/schema-based) transformation where one slave's prepare-execution servlet call returns a non-OK WebResult, e.g. the slave failed to allocate steps, open database connections, or initialize its TransMeta slice.","commonSituations":"Slave cannot reach a database or shared resource used by its transformation copy; variable/parameter values missing on the slave (Internal.Cluster.* or user variables not exported); transformation name or carteObjectId no longer registered on the slave; version skew between master and slave Kettle plugins.","solutions":["Read the appended webResult.getMessage() to find the root cause reported by the slave, and check that slave's carte.log.","Verify the slave server is reachable and the transformation definition (connections, variables) is exported to slaves (executionConfiguration set to export clustered config).","Ensure all required variables exist on slaves: declare them in the cluster schema / set them in TransExecutionConfiguration variables map.","Align Kettle versions and installed plugins on master and all slaves.","Re-run the cluster after fixing the slave-side error; consider SniffTest on a single slave first."],"exampleFix":"// before: clustered run fails because vars are not exported\nexecutionConfiguration.setVariables(vars);\n// after: ensure variables are exported to slaves before split/prepare\nexecutionConfiguration.setExportingClusteredTransformation(true);\nexecutionConfiguration.setVariables(vars);\ntrans.execute(new String[0]);","handlingStrategy":"try-catch","validationCode":"for (SlaveServer s : clusterSchema.getSlaveServers()) {\n  if (!s.getSlaveStatus().getStatusDescription().contains(\"OK\")) {\n    throw new KettleException(\"Slave not healthy: \" + s.getName());\n  }\n}\nif (executionConfiguration.getVariables().isEmpty()) {\n  throw new KettleException(\"No variables exported to slaves\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  trans.prepareExecution(new String[0]);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"preparing the execution of a slave\")) {\n    log.error(\"Slave prepare failed: \" + e.getMessage() + \", cause=\" + e.getCause(), e);\n    // inspect failing slave carte.log, then cleanup and retry\n  } else throw e;\n}","preventionTips":["Always export variables via TransExecutionConfiguration so slaves resolve them.","Health-check all slaves (getSlaveStatus) before starting a clustered run.","Keep Kettle and plugin versions identical across master and slaves.","Test the cluster schema with a small probe transformation first."],"tags":["kettle","clustered-transformation","slave-server","carte"],"backgroundTag":"http-error-response","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}