{"record":{"id":"ef6906c9a68e0cd2","repo":"JetBrains/intellij-community","slug":"failed-to-load-scriptfile","errorCode":null,"errorMessage":"\"Failed to load \" + scriptFile","messagePattern":"\"Failed to load \" \\+ scriptFile","errorType":"exception","errorClass":"IdeScriptException","httpStatus":null,"severity":"error","filePath":"grid/core-impl/src/extensions/ExtensionScriptsUtil.java","lineNumber":142,"sourceCode":"    }\n  }\n\n  public static Object evalScript(@Nullable Project project,\n                                  @NotNull IdeScriptEngine engine,\n                                  @NotNull Path scriptFile) throws IdeScriptException {\n    return evalScript(project, engine, scriptFile, true);\n  }\n\n  public static Object evalScript(@Nullable Project project,\n                                  @NotNull IdeScriptEngine engine,\n                                  @NotNull Path scriptFile,\n                                  boolean showErrorMessage) throws IdeScriptException {\n    try {\n      String script = loadScript(project, scriptFile);\n      return engine.eval(script);\n    }\n    catch (IOException e) {\n      throw new IdeScriptException(\"Failed to load \" + scriptFile, e);\n    }\n    catch (IdeScriptException e) {\n      ProgressManager.checkCanceled();\n      ProcessCanceledException pce = ExceptionUtil.findCause(e, ProcessCanceledException.class);\n      if (pce != null) throw pce;\n      if (showErrorMessage) {\n        showScriptExecutionError(project, scriptFile, ExceptionUtil.getRootCause(e));\n      }\n      throw e;\n    }\n  }\n\n  public static void showScriptExecutionError(@Nullable Project project, @NotNull Path scriptFile, @NotNull Throwable error) {\n    //noinspection HardCodedStringLiteral\n    NotificationGroupManager.getInstance().getNotificationGroup(DataGridNotifications.EXTRACTORS_GROUP_ID)\n      .createNotification(\"<a href=\\\"generator\\\">\" + scriptFile.getFileName() + \"</a>: \" + ExceptionUtil.getThrowableText(error, \"com.intellij.\"),\n        NotificationType.ERROR)\n      .setListener((notification, event) -> navigateToFile(project, scriptFile))","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/grid/core-impl/src/extensions/ExtensionScriptsUtil.java#L124-L160","documentation":"ExtensionScriptsUtil.evalScript wraps an IOException from loadScript into IdeScriptException('Failed to load ' + scriptFile). The script engine never ran; the .ide script file itself could not be read (missing, unreadable, or wrong path).","triggerScenarios":"Calling evalScript(project, engine, scriptFile, ...) where loadScript(project, scriptFile) throws IOException: file deleted between discovery and load, wrong path, permission denied, or unreadable encoding.","commonSituations":"User-edited .ide scripts in the config directory removed/renamed while the IDE session is running; scripts directory migrated; file locked by another process on Windows; path with invalid characters.","solutions":["Verify Files.isRegularFile(scriptFile) and Files.isReadable(scriptFile) before evaluating","Check the path resolves inside the expected scripts directory (avoid relative-path drift after working directory changes)","If the file was intentionally removed, skip evaluation instead of reporting; otherwise restore the file or fix permissions","Report the path from the exception message to pinpoint which script failed"],"exampleFix":"// before\nObject result = ExtensionScriptsUtil.evalScript(project, engine, scriptFile, true);\n\n// after\nif (Files.isRegularFile(scriptFile) && Files.isReadable(scriptFile)) {\n  Object result = ExtensionScriptsUtil.evalScript(project, engine, scriptFile, true);\n}","handlingStrategy":"validation","validationCode":"if (Files.isRegularFile(scriptFile) && Files.isReadable(scriptFile)) {\n  Object result = ExtensionScriptsUtil.evalScript(project, engine, scriptFile, true);\n}","typeGuard":null,"tryCatchPattern":"catch (IdeScriptException e) { if (e.getCause() instanceof IOException) { /* file-level failure: fix path or skip script */ } else { /* script body failure: show engine error */ } }","preventionTips":["Re-validate script existence at load time, not at session start","Resolve script paths against the IDE config directory, not the process CWD","Watch the script directory for deletions/renames and unregister handlers"],"tags":["scripting","io","file-not-found","intellij"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}