{"record":{"id":"50fee11159086171","repo":"pentaho/pentaho-kettle","slug":"condition-with-id-condition-id-condition-could-not-be-found","errorCode":null,"errorMessage":"Condition with id_condition={id_condition} could not be found in the repository","messagePattern":"Condition with id_condition=(.+?) could not be found in the repository","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryConditionDelegate.java","lineNumber":87,"sourceCode":"        if ( subids.length == 0 ) {\n          condition.setLeftValuename( r.getString( \"LEFT_NAME\", null ) );\n          condition.setFunction( Condition.getFunction( r.getString( \"CONDITION_FUNCTION\", null ) ) );\n          condition.setRightValuename( r.getString( \"RIGHT_NAME\", null ) );\n\n          long id_value = r.getInteger( \"ID_VALUE_RIGHT\", -1L );\n          if ( id_value > 0 ) {\n            ValueMetaAndData v = repository.loadValueMetaAndData( new LongObjectId( id_value ) );\n            condition.setRightExact( v );\n          }\n        } else {\n          for ( int i = 0; i < subids.length; i++ ) {\n            condition.addCondition( loadCondition( subids[i] ) );\n          }\n        }\n\n        return condition;\n      } else {\n        throw new KettleException( \"Condition with id_condition=\"\n          + id_condition + \" could not be found in the repository\" );\n      }\n    } catch ( KettleException dbe ) {\n      throw new KettleException(\n        \"Error loading condition from the repository (id_condition=\" + id_condition + \")\", dbe );\n    }\n  }\n\n  public ObjectId saveCondition( Condition condition ) throws KettleException {\n    return saveCondition( condition, null );\n  }\n\n  public ObjectId saveCondition( Condition condition, ObjectId id_condition_parent ) throws KettleException {\n    try {\n      condition.setObjectId( insertCondition( id_condition_parent, condition ) );\n      for ( int i = 0; i < condition.nrConditions(); i++ ) {\n        Condition subc = condition.getCondition( i );\n        repository.saveCondition( subc, condition.getObjectId() );","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryConditionDelegate.java#L69-L105","documentation":"Generic KettleException thrown by loadCondition when the given id_condition does not correspond to any row the repository condition lookup returns. The load loop expects a row set; if the first read has no data, the condition cannot be reconstructed. Typically indicates a dangling reference or a deleted condition record.","triggerScenarios":"loadCondition(id) invoked with an id that was deleted from R_CONDITION, a stale ObjectId stored in a step/job entry attribute, or a corrupt repository row.","commonSituations":"Loading old transformations after manual table cleanup, partial repository imports/exports, or upgrading across repository versions where condition rows were dropped.","solutions":["Verify the id exists with a direct query (SELECT * FROM R_CONDITION WHERE ID_CONDITION = ?)","Re-save the transformation/job to regenerate missing condition rows","Restore the condition rows from a repository backup","Catch KettleException at the load site and treat the condition as missing/default rather than aborting the whole load"],"exampleFix":"// before\nCondition c = conditionDelegate.loadCondition(savedId); // throws if deleted\n\n// after\nCondition c;\ntry {\n  c = conditionDelegate.loadCondition(savedId);\n} catch (KettleException e) {\n  c = new Condition(); // default empty condition\n}","handlingStrategy":"try-catch","validationCode":"RowMetaAndData row = connectionDelegate.getCondition(id); if (row == null || row.isEmpty()) { /* treat as missing before calling loadCondition */ }","typeGuard":"boolean conditionExists = id != null && repository.connectionDelegate.getCondition(id) != null;","tryCatchPattern":"try { c = delegate.loadCondition(id); } catch (KettleException e) { c = defaultCondition(); log.warn(\"Condition {} missing, using default\", id); }","preventionTips":["Never persist stale ObjectIds across repository restores","Restore full backups including R_CONDITION","Validate referential integrity after manual DB cleanup","Default missing conditions instead of failing whole loads"],"tags":["repository","condition","record-missing"],"backgroundTag":"record-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"}