{"record":{"id":"e965acdd34a3c42e","repo":"pentaho/pentaho-kettle","slug":"getjobsqlprogressdialog-runtimeerror-unabletogeneratesql","errorCode":"GetJobSQLProgressDialog.RuntimeError.UnableToGenerateSQL.Exception","errorMessage":"GetJobSQLProgressDialog.RuntimeError.UnableToGenerateSQL.Exception","messagePattern":"GetJobSQLProgressDialog\\.RuntimeError\\.UnableToGenerateSQL\\.Exception","errorType":"exception","errorClass":"InvocationTargetException","httpStatus":null,"severity":"error","filePath":"ui/src/main/java/org/pentaho/di/ui/spoon/dialog/GetJobSQLProgressDialog.java","lineNumber":67,"sourceCode":"  public GetJobSQLProgressDialog( Shell shell, JobMeta jobMeta, Repository repository ) {\n    this.shell = shell;\n    this.jobMeta = jobMeta;\n    this.repository = repository;\n\n  }\n\n  public List<SQLStatement> open() {\n    IRunnableWithProgress op = new IRunnableWithProgress() {\n      public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {\n        // This is running in a new process: copy some KettleVariables info\n        // LocalVariables.getInstance().createKettleVariables(Thread.currentThread(), kettleVariables.getLocalThread(),\n        // true);\n        // --> don't set variables if not running in different thread --> pmd.run(true,true, op);\n\n        try {\n          stats = jobMeta.getSQLStatements( repository, new ProgressMonitorAdapter( monitor ) );\n        } catch ( KettleException e ) {\n          throw new InvocationTargetException( e, BaseMessages.getString(\n            PKG, \"GetJobSQLProgressDialog.RuntimeError.UnableToGenerateSQL.Exception\", e.getMessage() ) ); // Error\n                                                                                                           // generating\n                                                                                                           // SQL for\n                                                                                                           // job:\n                                                                                                           // \\n{0}\n        }\n      }\n    };\n\n    try {\n      ProgressMonitorDialog pmd = new ProgressMonitorDialog( shell );\n      pmd.run( false, false, op );\n    } catch ( InvocationTargetException e ) {\n      new ErrorDialog( shell, BaseMessages.getString( PKG, \"GetJobSQLProgressDialog.Dialog.UnableToGenerateSQL.Title\" ),\n        BaseMessages.getString( PKG, \"GetJobSQLProgressDialog.Dialog.UnableToGenerateSQL.Message\" ), e );\n      stats = null;\n    } catch ( InterruptedException e ) {\n      new ErrorDialog( shell, BaseMessages.getString( PKG, \"GetJobSQLProgressDialog.Dialog.UnableToGenerateSQL.Title\" ),","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/ui/src/main/java/org/pentaho/di/ui/spoon/dialog/GetJobSQLProgressDialog.java#L49-L85","documentation":"GetJobSQLProgressDialog runs jobMeta.getSQLStatements(repository, monitor) on a background thread to generate the SQL needed by a job. Any KettleException is wrapped in an InvocationTargetException with localized message GetJobSQLProgressDialog.RuntimeError.UnableToGenerateSQL.Exception (the wrapped e.getMessage() is substituted).","triggerScenarios":"Opening the job SQL generation dialog when a job entry or the job metadata cannot produce SQL statements: a job entry referencing a missing transformation/file, or an invalid/null repository handle.","commonSituations":"Job entries pointing to transformations or files that no longer exist; repository connection lost; invalid database metadata used by job entries.","solutions":["Inspect the wrapped KettleException message to find which job entry failed.","Verify every job entry's referenced transformation/job exists and is resolvable.","Reconnect to the repository and retry SQL generation.","Fix database metadata entries referenced by job entries."],"exampleFix":"// before\nJobEntryTrans entry = ...; entry.setFilename(\"missing.ktr\");\n// after\nentry.setFilename(\"/valid/path/exists.ktr\"); // reference must exist before SQL generation","handlingStrategy":"validation","validationCode":"for (JobEntryCopy copy : jobMeta.getJobEntries()) {\n  JobEntryInterface je = copy.getEntry();\n  if (je instanceof JobEntryTrans) {\n    String f = ((JobEntryTrans) je).getFilename();\n    if (f != null && !new File(f).exists()) {\n      throw new IllegalStateException(\"Job entry references missing transformation: \" + f);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  new GetJobSQLProgressDialog(shell, jobMeta, repository).open();\n} catch (Exception e) {\n  log.error(\"Job SQL generation failed: \", e);\n}","preventionTips":["Verify referenced transformations/files exist before SQL generation.","Keep repository sessions alive during long edits.","Validate database metadata on job entries."],"tags":["pdi","job","sql-generation","progress-dialog"],"backgroundTag":"file-not-found","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"}