{"record":{"id":"c8b2ffb07374adbb","repo":"pentaho/pentaho-kettle","slug":"the-tablename-is-not-defined-empty-tableoutput","errorCode":null,"errorMessage":"The tablename is not defined (empty)","messagePattern":"The tablename is not defined \\(empty\\)","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutput.java","lineNumber":237,"sourceCode":"          + \"_\" + data.dateFormater.format( (Date) partitioningValueData );\n      insertRowData = r;\n    } else {\n      tableName = data.tableName;\n      insertRowData = r;\n    }\n\n    if ( meta.specifyFields() ) {\n      //\n      // The values to insert are those in the fields sections\n      //\n      insertRowData = new Object[data.valuenrs.length];\n      for ( int idx = 0; idx < data.valuenrs.length; idx++ ) {\n        insertRowData[idx] = r[data.valuenrs[idx]];\n      }\n    }\n\n    if ( Utils.isEmpty( tableName ) ) {\n      throw new KettleStepException( \"The tablename is not defined (empty)\" );\n    }\n\n    insertStatement = data.preparedStatements.get( tableName );\n    if ( insertStatement == null ) {\n      String sql =\n        data.db\n          .getInsertStatement( environmentSubstitute( meta.getSchemaName() ), tableName, data.insertRowMeta );\n      if ( log.isDetailed() ) {\n        logDetailed( \"Prepared statement : \" + sql );\n      }\n      insertStatement = data.db.prepareSQL( sql, meta.isReturningGeneratedKeys() );\n      data.preparedStatements.put( tableName, insertStatement );\n    }\n\n    try {\n      // For PG & GP, we add a savepoint before the row.\n      // Then revert to the savepoint afterwards... (not a transaction, so hopefully still fast)\n      //","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutput.java#L219-L255","documentation":"After all table-name resolution paths (static name, table-name-in-field, partitioned naming), the computed tableName string is null or empty. The step cannot build an INSERT statement for an unnamed table, so it throws before consulting its prepared-statement cache.","triggerScenarios":"Utils.isEmpty(tableName) is true: the static 'Table name' setting is blank and no table-name field/partitioning logic produced a name, or the table name field's value is empty in the current row.","commonSituations":"Forgetting to fill in the 'Table name' in the dialog; the table-name field contains an empty string or null for some rows; environment variable in the table name unset so it substitutes to empty.","solutions":["Enter a valid table name in the TableOutput step's 'Table name' field.","If using 'Table name in a field', ensure the field value is non-empty for every row.","Verify any environment variables used in the table name are defined at runtime."],"exampleFix":"// before\nmeta.setTableName( \"${TARGET_TABLE}\" ); // TARGET_TABLE not defined -> \"\"\n// after\nmeta.setTableName( \"customer_output\" ); // or define TARGET_TABLE in run config","handlingStrategy":"validation","validationCode":"String tableName = resolveTableName(); // static, field, or partition logic\nif ( tableName == null || tableName.trim().isEmpty() ) {\n  throw new IllegalArgumentException( \"Target table name is empty; fill in the Table name setting\" );\n}","typeGuard":null,"tryCatchPattern":"try { processRow(); } catch ( KettleStepException e ) {\n  if ( \"The tablename is not defined (empty)\".equals( e.getMessage() ) ) {\n    // set a table name in step config or fix table-name field values\n  }\n}","preventionTips":["Always fill in the 'Table name' (or a reliable table-name field) before running","Verify environment variables used in table names are defined in the run configuration","Add an upstream validation step rejecting rows with empty table-name values"],"tags":["kettle","table-output","empty-value","configuration"],"backgroundTag":"empty-required-field","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"}