JetBrains/intellij-community · error · IdeScriptException
"Failed to load " + scriptFile
Error message
"Failed to load " + scriptFile
What it means
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).
Source
Thrown at grid/core-impl/src/extensions/ExtensionScriptsUtil.java:142
}
}
public static Object evalScript(@Nullable Project project,
@NotNull IdeScriptEngine engine,
@NotNull Path scriptFile) throws IdeScriptException {
return evalScript(project, engine, scriptFile, true);
}
public static Object evalScript(@Nullable Project project,
@NotNull IdeScriptEngine engine,
@NotNull Path scriptFile,
boolean showErrorMessage) throws IdeScriptException {
try {
String script = loadScript(project, scriptFile);
return engine.eval(script);
}
catch (IOException e) {
throw new IdeScriptException("Failed to load " + scriptFile, e);
}
catch (IdeScriptException e) {
ProgressManager.checkCanceled();
ProcessCanceledException pce = ExceptionUtil.findCause(e, ProcessCanceledException.class);
if (pce != null) throw pce;
if (showErrorMessage) {
showScriptExecutionError(project, scriptFile, ExceptionUtil.getRootCause(e));
}
throw e;
}
}
public static void showScriptExecutionError(@Nullable Project project, @NotNull Path scriptFile, @NotNull Throwable error) {
//noinspection HardCodedStringLiteral
NotificationGroupManager.getInstance().getNotificationGroup(DataGridNotifications.EXTRACTORS_GROUP_ID)
.createNotification("<a href=\"generator\">" + scriptFile.getFileName() + "</a>: " + ExceptionUtil.getThrowableText(error, "com.intellij."),
NotificationType.ERROR)
.setListener((notification, event) -> navigateToFile(project, scriptFile))View on GitHub (pinned to be881553f2)
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
Example fix
// before
Object result = ExtensionScriptsUtil.evalScript(project, engine, scriptFile, true);
// after
if (Files.isRegularFile(scriptFile) && Files.isReadable(scriptFile)) {
Object result = ExtensionScriptsUtil.evalScript(project, engine, scriptFile, true);
} Defensive patterns
Strategy: validation
Validate before calling
if (Files.isRegularFile(scriptFile) && Files.isReadable(scriptFile)) {
Object result = ExtensionScriptsUtil.evalScript(project, engine, scriptFile, true);
} Try / catch
catch (IdeScriptException e) { if (e.getCause() instanceof IOException) { /* file-level failure: fix path or skip script */ } else { /* script body failure: show engine error */ } } Prevention
- 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
When it happens
Trigger: Calling evalScript(project, engine, scriptFile, ...) where loadScript(project, scriptFile) throws IOException: file deleted between discovery and load, wrong path, permission denied, or unreadable encoding.
Common situations: 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.
Related errors
- error.message.unable.to.create.file
- Row index: %d. Error during nested table row creation: row i
- Column number: %d. Error during retrieving value from nested
- Column number: %d. Error during setting value in nested tabl
- Column index: %d. Error during nested table column creation:
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/ef6906c9a68e0cd2.
Report an issue: GitHub.