{"record":{"id":"e6dacdfe503e3132","repo":"pentaho/pentaho-kettle","slug":"unable-to-load-xml-object-from-object-with-id-id-and-tag-tag","errorCode":null,"errorMessage":"Unable to load XML object from object with ID [ + id + ] and tag [ + tag + ]","messagePattern":"Unable to load XML object from object with ID \\[ \\+ id \\+ \\] and tag \\[ \\+ tag \\+ \\]","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java","lineNumber":903,"sourceCode":"\n  @Override\n  public Condition loadConditionFromStepAttribute( ObjectId id_step, String code ) throws KettleException {\n\n    return null;\n  }\n\n  public Node loadNodeFromXML( ObjectId id, String tag ) throws KettleException {\n    try {\n      // The object ID is the base name of the file in the Base directory folder\n      //\n      String filename = calcDirectoryName( null ) + id.getId();\n      FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename );\n      Document document = XMLHandler.loadXMLFile( fileObject );\n      Node node = XMLHandler.getSubNode( document, tag );\n\n      return node;\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to load XML object from object with ID [\"\n        + id + \"] and tag [\" + tag + \"]\", e );\n    }\n  }\n\n  @Override\n  public DatabaseMeta loadDatabaseMeta( ObjectId id_database, String versionName ) throws KettleException {\n    try {\n      return new DatabaseMeta( loadNodeFromXML( id_database, DatabaseMeta.XML_TAG ) );\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to load database connection from the file repository\", e );\n    }\n  }\n\n  @Override\n  public DatabaseMeta loadDatabaseMetaFromJobEntryAttribute( ObjectId id_jobentry, String nameCode, int nr,\n    String idCode, List<DatabaseMeta> databases ) throws KettleException {\n    return null;\n  }","sourceCodeStart":885,"sourceCodeEnd":921,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java#L885-L921","documentation":"loadNodeFromXML(id, tag) resolves the repository file for the given ObjectId, loads it through KettleVFS, and extracts the requested XML subnode. Any failure in file resolution, VFS access, XML parsing, or missing subnode handling is wrapped into this KettleException that names both the object id and the requested tag. It is the low-level workhorse behind most load* methods of the file repository.","triggerScenarios":"Calling any repository load that routes through loadNodeFromXML when the object's file does not exist, the path cannot be resolved by the VFS, the file contains malformed XML, or Document/subnode lookup throws.","commonSituations":"ObjectId from a stale cache referencing a deleted file; repository base directory misconfigured so relative paths resolve elsewhere; file moved by external tools; non-XML or truncated file left by an interrupted save.","solutions":["Confirm the object file for the id exists under the repository base directory","Validate the file is well-formed XML and contains the requested tag","Fix the repository base-directory configuration if paths resolve incorrectly","Re-export/recreate the object if the file is truncated or corrupt"],"exampleFix":"// before\nNode node = repository.loadNodeFromXML(objectId, DatabaseMeta.XML_TAG);\n// after\nFile f = new File(repoBase, objectId.getId()); // or resolve via directory tree\nif (!f.exists()) { throw new KettleException(\"Object file missing: \" + f); }\nNode node = repository.loadNodeFromXML(objectId, DatabaseMeta.XML_TAG);","handlingStrategy":"validation","validationCode":"File f = resolveObjectFile(repoBaseDirectory, id);\nif (!f.isFile()) throw new KettleException(\"Repository object file missing: \" + f);\ntry { new XmlValidator().validate(f.toPath()); } catch (Exception ex) { throw new KettleException(\"Object file is not valid XML: \" + f, ex); }","typeGuard":null,"tryCatchPattern":"try {\n  Node node = repository.loadNodeFromXML(id, tag);\n} catch (KettleException e) {\n  logger.error(\"loadNodeFromXML failed for id=\" + id + \" tag=\" + tag + \": \" + e.getCause(), e);\n  throw e;\n}","preventionTips":["Refresh ObjectIds from the directory tree instead of caching them","Prevent interrupted saves (avoid killing Spoon mid-write; use version control)","Keep the repository base directory configuration consistent across environments"],"tags":["file-repository","kettle","vfs","xml-parse"],"backgroundTag":"file-read-failed","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"}