{"record":{"id":"971f4c8fd8155086","repo":"pentaho/pentaho-kettle","slug":"unable-to-verify-if-the-repository-element","errorCode":null,"errorMessage":"Unable to verify if the repository element [","messagePattern":"Unable to verify if the repository element \\[","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":920,"sourceCode":"    rootRef.clearRef();\n  }\n\n  @Override\n  public boolean exists( final String name, final RepositoryDirectoryInterface repositoryDirectory,\n                         final RepositoryObjectType objectType ) throws KettleException {\n    try {\n      String absPath = getPath( name, repositoryDirectory, objectType );\n      readWriteLock.readLock().lock();\n      boolean result;\n      try {\n        result = pur.getFile( absPath ) != null;\n      } finally {\n        readWriteLock.readLock().unlock();\n      }\n\n      return result;\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to verify if the repository element [\" + name + \"] exists in \", e );\n    }\n  }\n\n  protected String getPath( final String name, final RepositoryDirectoryInterface repositoryDirectory,\n                          final RepositoryObjectType objectType ) {\n\n    String path = null;\n\n    // need to check for null id since shared objects return a non-null repoDir (see\n    // partSchema.getRepositoryDirectory())\n    if ( repositoryDirectory != null && repositoryDirectory.getObjectId() != null ) {\n      path = repositoryDirectory.getPath();\n    }\n\n    // return the directory path\n    if ( objectType == null ) {\n      return path;\n    }","sourceCodeStart":902,"sourceCodeEnd":938,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L902-L938","documentation":"The repository-exists check (verify element by name/type under a directory) failed: any exception computing the result is wrapped as 'Unable to verify if the repository element [name] exists'. The read lock is held while resolving the path; the wrap loses the original cause unless inspected.","triggerScenarios":"Calling the exists/verify method with a name and RepositoryObjectType whose path resolution or child lookup throws — invalid directory reference, PUR service error, or malformed name for getPath.","commonSituations":"Names with special characters ('/', spaces) that break path construction; checking existence in a directory that was deleted; session expired against the BA server.","solutions":["Inspect e.getCause() to see whether the path lookup or the service call failed.","Validate the object name (no path separators, non-empty) before the exists check.","Ensure the target repository directory reference is valid and current.","Reconnect to the repository if the session has expired."],"exampleFix":"// before\nboolean ok = repo.exists(name, dir, type);\n// after\nString safe = name.replaceAll(\"[/\\\\\\\\]\", \"_\");\nboolean ok = repo.exists(safe, dir, type);","handlingStrategy":"validation","validationCode":"if (name == null || name.isEmpty() || name.contains(\"/\")) {\n  throw new IllegalArgumentException(\"Invalid repository object name: \" + name);\n}","typeGuard":"null","tryCatchPattern":"try {\n  exists = repo.exists(name, dir, type);\n} catch (KettleException e) {\n  log.error(\"Exists check failed for {}: {}\", name, e.getCause());\n  exists = false;\n}","preventionTips":["Sanitize object names (no path separators).","Ensure the directory reference is from the current tree.","Treat exists-check failure distinctly from a false result."],"tags":["repository","exists-check","pentaho","lookup"],"backgroundTag":"entity-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"}