mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 04:31:58 +00:00
fix: show Missing Nodes dialog for missing node prompt errors (#8511)
## Summary When a workflow is queued with a missing node type, show the Missing Nodes dialog instead of a generic error toast. This gives users actionable options like "Open Manager" and "Install All". ## Changes - Detect `missing_node_type` error from backend in `queuePrompt()` catch block - Construct `MissingNodeType` object with class type and contextual hint - Reuse existing `showMissingNodesError()` to trigger the dialog ## Dependencies ⚠️ **Requires backend PR:** https://github.com/Comfy-Org/ComfyUI/pull/12177 The backend PR changes the error type from `invalid_prompt` to `missing_node_type` and adds `extra_info` with node details. ## Related - Fixes COM-12528 - Addresses ~49 GitHub issues with confusing "missing class_type" errors ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8511-fix-show-Missing-Nodes-dialog-for-missing-node-prompt-errors-2f96d73d3650812b95f0f08e51abaabb) by [Unito](https://www.unito.io) --------- Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import type { MissingNodeType } from '@/types/comfy'
|
||||
|
||||
import type { MissingNodeTypeExtraInfo } from '../types/missingNodeErrorTypes'
|
||||
|
||||
/**
|
||||
* Builds a hint string from missing node metadata.
|
||||
* Provides context about which node is missing (title, ID) when available.
|
||||
*/
|
||||
export function buildMissingNodeHint(
|
||||
nodeTitle: string | null | undefined,
|
||||
classType: string,
|
||||
nodeId: string | undefined
|
||||
): string | undefined {
|
||||
const hasTitle = nodeTitle && nodeTitle !== classType
|
||||
if (hasTitle && nodeId) {
|
||||
return `"${nodeTitle}" (Node ID #${nodeId})`
|
||||
} else if (hasTitle) {
|
||||
return `"${nodeTitle}"`
|
||||
} else if (nodeId) {
|
||||
return `Node ID #${nodeId}`
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MissingNodeType from backend error extra_info.
|
||||
* Used when the /prompt endpoint returns a missing_node_type error.
|
||||
*/
|
||||
export function createMissingNodeTypeFromError(
|
||||
extraInfo: MissingNodeTypeExtraInfo
|
||||
): MissingNodeType {
|
||||
const classType = extraInfo.class_type ?? 'Unknown'
|
||||
const nodeTitle = extraInfo.node_title ?? classType
|
||||
const hint = buildMissingNodeHint(nodeTitle, classType, extraInfo.node_id)
|
||||
|
||||
return hint ? { type: classType, hint } : classType
|
||||
}
|
||||
Reference in New Issue
Block a user