{"record":{"id":"15a0f8df4ca33c1a","repo":"pentaho/pentaho-kettle","slug":"unable-to-load-image-with-name-location","errorCode":null,"errorMessage":"Unable to load image with name [<location>]","messagePattern":"Unable to load image with name \\[<location>\\]","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"ui/src/main/java/org/pentaho/di/ui/util/ImageUtil.java","lineNumber":88,"sourceCode":"    if ( cl == null ) {\n      // Can't count on Thread.currentThread().getContextClassLoader() being non-null on Mac\n      // Have to provide some fallback\n      cl = ImageUtil.class.getClassLoader();\n    }\n    URL res = cl.getResource( location );\n    if ( res != null ) {\n      try {\n        java.io.InputStream s = res.openStream();\n        return s;\n      } catch ( IOException e ) {\n        // do nothing. just move on to trying to load via file system\n      }\n    }\n    try {\n      FileObject imageFileObject = KettleVFS.getInstance().getFileSystemManager().resolveFile( base, location );\n      return KettleVFS.getInputStream( imageFileObject );\n    } catch ( FileSystemException e ) {\n      throw new RuntimeException( \"Unable to load image with name [\" + location + \"]\", e );\n    }\n  }\n\n  /**\n   * TODO: Load splash and common images.\n   */\n  public static Image getImageAsResource( Display display, String location ) {\n    return new Image( display, getImageInputStream( display, location ) );\n  }\n\n  /**\n   * TODO: not used.\n   */\n  public static Image getImage( Display display, Class<?> resourceClass, String filename ) {\n    try {\n      return new Image( display, resourceClass.getResourceAsStream( filename ) );\n    } catch ( Exception e ) {\n      try {","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/ui/src/main/java/org/pentaho/di/ui/util/ImageUtil.java#L70-L106","documentation":"ImageUtil.getImageInputStream resolves the image location through KettleVFS (first against registered bases, then the filesystem) and wraps any VFS FileSystemException in a RuntimeException naming the image location. It signals that no image resource could be resolved for the given name/path.","triggerScenarios":"Calling ImageUtil.getImageAsResource with a location string that is not resolvable by KettleVFS — e.g. a missing plugin image, a typo'd resource path, or a file absent from the filesystem/classpath.","commonSituations":"Plugin ships images not on the classpath; relocated UI resources after a version upgrade; case-mismatched resource names on Linux; broken KettleVFS base configuration.","solutions":["Verify the image path/name exists on the classpath or filesystem (mind case sensitivity)","If part of a plugin, confirm the plugin jar contains the image and the plugin is installed correctly","Fix the location string passed to getImageAsResource","Check KettleVFS resolution base configuration"],"exampleFix":"// before\nImage img = ImageUtil.getImageAsResource(display, \"images/myicon.png\"); // throws if missing\n// after (guard for existence)\nInputStream in = ImageUtil.class.getClassLoader().getResourceAsStream(\"images/myicon.png\");\nif (in != null) { Image img = ImageUtil.getImageAsResource(display, \"images/myicon.png\"); in.close(); }","handlingStrategy":"fallback","validationCode":"InputStream in = ImageUtil.class.getClassLoader().getResourceAsStream(location);\nboolean available = in != null;\nif (in != null) { in.close(); }","typeGuard":"boolean isImageResolvable(String location) {\n  try { return ImageUtil.class.getClassLoader().getResource(location) != null; }\n  catch (Exception e) { return false; }\n}","tryCatchPattern":"try {\n  Image img = ImageUtil.getImageAsResource(display, location);\n} catch (RuntimeException e) {\n  log.warn(\"Image {} missing, using placeholder\", location, e);\n  Image img = display.getSystemImage(SWT.ICON_WARNING);\n}","preventionTips":["Keep image resources inside the jar at expected paths","Verify exact case of resource paths (Linux is case-sensitive)","Test image loading after plugin installation or version upgrades"],"tags":["vfs","image-loading","classpath","runtime-exception"],"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"}