Skip to content

Commit 74f178d

Browse files
jonnyzzzclaude
andcommitted
Fix assertion error when plugin unload fails
Return early from reloadPluginFromFile when DynamicPlugins.unloadPlugin() returns false, instead of attempting to load the new plugin. This prevents the assertion in PluginSet.withPlugin() which expects any existing plugin to have isMarkedForLoading=false before loading a new version. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 345083a commit 74f178d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/main/kotlin/com/jonnyzzz/intellij/hotreload/PluginHotReloadService.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,24 @@ class PluginHotReloadService {
167167
if (!unloaded) {
168168
val warnMsg = HotReloadBundle.message("error.unload.failed")
169169
log.warn(warnMsg)
170-
progress.report(warnMsg)
170+
progress.reportError(warnMsg)
171171

172172
// Create memory dump if unload failed
173173
if (MemoryDumpHelper.memoryDumpAvailable()) {
174174
memoryDumpPath = createMemoryDump(pluginIdString, progress)
175175
}
176+
177+
// Return early - cannot proceed with loading new plugin
178+
// when old plugin is still loaded (would cause assertion in PluginSet.withPlugin)
179+
return ReloadResult(
180+
success = false,
181+
message = warnMsg,
182+
pluginId = pluginIdString,
183+
pluginName = existingPlugin.name,
184+
restartRequired = true,
185+
memoryDumpPath = memoryDumpPath,
186+
unloadBlockedReason = unloadBlockedReason
187+
)
176188
} else {
177189
progress.report(HotReloadBundle.message("progress.unloaded"))
178190
}

0 commit comments

Comments
 (0)