Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(create-3d): an older ComfyUI gets the update offer instead of a RemeshMesh crash

purplee9c1942327fd
diff --git a/src/api/__tests__/three-d-workflow.test.ts b/src/api/__tests__/three-d-workflow.test.ts
index eb4029ef..6379b136 100644
--- a/src/api/__tests__/three-d-workflow.test.ts
+++ b/src/api/__tests__/three-d-workflow.test.ts
@@ -6,7 +6,7 @@
import { describe, it, expect } from 'vitest'
import {
buildThreeDWorkflow, THREE_D_DETAIL, THREE_D_NODES, THREE_D_CUTOUT_NODES, THREE_D_SAVE_NODE,
- WorkflowUnavailableError, type ThreeDParams,
+ WorkflowUnavailableError, dynamicComboKeys, type ThreeDParams,
} from '../dynamic-workflow'
import { TRELLIS2_FILES } from '../model-bundles'
import type { ComfyApiGraph } from '../../types/comfy-graph'
@@ -170,6 +170,49 @@ describe('buildThreeDWorkflow', () => {
expect(() => build({}, noSave)).toThrow(/newer/)
})
+ // RemeshMesh's sign_mode as /object_info serves it (DynamicCombo.Input.as_dict,
+ // comfy_api/latest/_io.py). ComfyUI 0.36 to 0.41 offer udf and sdf only;
+ // 'solid' came with 0.42.0 (comfy_extras/nodes_mesh_postprocess.py).
+ const qef = { qef: ['BOOLEAN', { default: false }] }
+ const remesh = (keys: string[]) => ({
+ input: {
+ required: {
+ mesh: ['MESH', {}], resolution: ['INT', { default: 512 }],
+ sign_mode: ['COMFY_DYNAMICCOMBO_V3', {
+ display_name: 'sign_mode',
+ options: keys.map((key) => ({ key, inputs: { required: key === 'solid' ? { fill: ['FLOAT', { default: 20 }], ...qef } : qef } })),
+ }],
+ },
+ },
+ })
+
+ it('reads the choices of a DynamicCombo from /object_info, and says when it cannot', () => {
+ expect(dynamicComboKeys(remesh(['udf', 'sdf', 'solid']), 'sign_mode')).toEqual(['udf', 'sdf', 'solid'])
+ expect(dynamicComboKeys({ input: { optional: { sign_mode: [['udf', 'sdf']] } } }, 'sign_mode')).toEqual(['udf', 'sdf'])
+ for (const unknown of [undefined, {}, true, { input: {} }, { input: { required: { sign_mode: 'x' } } }, { input: { required: { sign_mode: ['COMFY_DYNAMICCOMBO_V3', {}] } } }]) {
+ expect(dynamicComboKeys(unknown, 'sign_mode')).toBeNull()
+ }
+ })
+
+ it('runs on a ComfyUI whose RemeshMesh offers solid (0.42 and newer)', () => {
+ const g = build({}, { ...ALL, RemeshMesh: remesh(['udf', 'sdf', 'solid']) })
+ expect(g['241'].inputs).toMatchObject({ sign_mode: 'solid', 'sign_mode.fill': 20, 'sign_mode.qef': false })
+ })
+
+ it('asks for an update, before the run, on a ComfyUI whose RemeshMesh has no solid (0.36 to 0.41)', () => {
+ // There 'solid' matches no option, ComfyUI drops sign_mode and the node
+ // fails with "missing 1 required positional argument: 'sign_mode'".
+ const old = { ...ALL, RemeshMesh: remesh(['udf', 'sdf']) }
+ expect(() => build({}, old)).toThrow(WorkflowUnavailableError)
+ expect(() => build({}, old)).toThrow(/ComfyUI 0\.42\.4 or newer\. Update ComfyUI in Settings\./)
+ try { build({}, old) } catch (e) { expect((e as WorkflowUnavailableError).needsComfyUpdate).toBe(true) }
+ })
+
+ it('keeps going where the entry cannot be read, as before', () => {
+ expect(build({}, { ...ALL, RemeshMesh: { input: { required: { sign_mode: ['COMFY_DYNAMICCOMBO_V3', {}] } } } })['241'].inputs)
+ .toMatchObject({ sign_mode: 'solid' })
+ })
+
it('refuses a cutout when the cutout nodes are missing', () => {
const noCut = Object.fromEntries(THREE_D_NODES.map((n) => [n, {}]))
expect(() => build({ cutout: true }, noCut)).toThrow(/RemoveBackground/)
diff --git a/src/api/dynamic-workflow.ts b/src/api/dynamic-workflow.ts
index 87e8757e..81223003 100644
--- a/src/api/dynamic-workflow.ts
+++ b/src/api/dynamic-workflow.ts
@@ -2225,6 +2225,29 @@ export const THREE_D_CUTOUT_NODES = ['LoadBackgroundRemovalModel', 'RemoveBackgr
/** The id of the save node, whose history entry carries the model. */
export const THREE_D_SAVE_NODE = '900'
+/** The choices of a DynamicCombo input in one node's /object_info entry,
+ * which ComfyUI serves as ["COMFY_DYNAMICCOMBO_V3", { options: [{ key, inputs }] }]
+ * (comfy_api/latest/_io.py, DynamicCombo.Input.as_dict). A plain combo
+ * ([[...choices]]) reads too. Null when the entry says nothing readable,
+ * so a caller can tell "unknown" from "not offered". */
+export function dynamicComboKeys(nodeInfo: unknown, field: string): string[] | null {
+ if (!nodeInfo || typeof nodeInfo !== 'object') return null
+ const input = (nodeInfo as { input?: { required?: Record<string, unknown>; optional?: Record<string, unknown> } }).input
+ const spec = input?.required?.[field] ?? input?.optional?.[field]
+ if (!Array.isArray(spec)) return null
+ if (Array.isArray(spec[0])) return spec[0].filter((k): k is string => typeof k === 'string')
+ const options = (spec[1] as { options?: unknown } | undefined)?.options
+ if (!Array.isArray(options)) return null
+ return options.map((o) => (o as { key?: unknown })?.key).filter((k): k is string => typeof k === 'string')
+}
+
+/** RemeshMesh's sign_mode choice. 'solid' came with ComfyUI 0.42.0; 0.36 to
+ * 0.41 have the TRELLIS.2 nodes and RemeshMesh but offer only udf and sdf.
+ * Sent there, 'solid' matches no option, ComfyUI drops the input without a
+ * word and the node fails with "execute() missing 1 required positional
+ * argument: 'sign_mode'" (3.1.0, reported 17.11.2026). */
+export const THREE_D_SIGN_MODE = 'solid'
+
function sampler(
model: [string, number], cond: string, latent: [string, number], seed: number,
steps: number, cfg: number, scheduler: string,
@@ -2239,6 +2262,12 @@ export function buildThreeDWorkflow(params: ThreeDParams, allNodes: NodePresence
requireRelease(allNodes, THREE_D_TRELLIS_NODES, THREE_D_NEEDS_UPDATE, 'unavailable')
requireRelease(allNodes, ['SaveGLB', 'RemeshMesh', 'BakeTextureFromVoxel'], THREE_D_NEEDS_UPDATE, 'unavailable')
requireNodes(allNodes, THREE_D_NODES, 'Local 3D')
+ // The node is there, but is its remesh choice? Asked of /object_info before
+ // the run, so an older ComfyUI gets the update offer, not a failed run.
+ const signModes = dynamicComboKeys(allNodes.RemeshMesh, 'sign_mode')
+ if (signModes && !signModes.includes(THREE_D_SIGN_MODE)) {
+ throw new WorkflowUnavailableError(THREE_D_NEEDS_UPDATE, 'unavailable', undefined, { needsComfyUpdate: true })
+ }
if (params.cutout) requireNodes(allNodes, THREE_D_CUTOUT_NODES, 'Local 3D')
const files = { ...TRELLIS2_FILES, ...params.files }
const d = THREE_D_DETAIL[params.detail] ?? THREE_D_DETAIL.standard
@@ -2298,7 +2327,7 @@ export function buildThreeDWorkflow(params: ThreeDParams, allNodes: NodePresence
mesh: ['92', 0], resolution: d.remeshResolution,
// A DynamicCombo: the choice under its own name, its options as
// "sign_mode.<name>" (comfy_api/latest/_io.py, finalize_prefix).
- sign_mode: 'solid', 'sign_mode.fill': 20, 'sign_mode.qef': false,
+ sign_mode: THREE_D_SIGN_MODE, 'sign_mode.fill': 20, 'sign_mode.qef': false,
band: 1, project_back: 0, fix_poles: false, smooth_iters: 20,
drop_small_components: 0.01, precluster_max_verts: 20_000_000,
},
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index bc7a6890..d2e14ada 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -245,6 +245,10 @@ async function runLocalThreeD(state: CreateState, seed: number, abortRef: { curr
// Stopped by the user: nothing to say.
} else if (name === 'Mesh3dNoObject') {
useCreateStore.getState().setError(THREE_D_TEXT.noObject)
+ } else if (name === 'WorkflowUnavailableError') {
+ // Checked before the run (a ComfyUI too old for the graph, a missing
+ // node): the sentence says what to do, a "failed" in front would not.
+ useCreateStore.getState().setError(e instanceof Error ? e.message : String(e))
} else {
useCreateStore.getState().setError(`3D failed: ${e instanceof Error ? e.message : String(e)}`)
}
diff --git a/src/lib/__tests__/local-3d-comfy.test.ts b/src/lib/__tests__/local-3d-comfy.test.ts
index 2c7f16ec..72527a48 100644
--- a/src/lib/__tests__/local-3d-comfy.test.ts
+++ b/src/lib/__tests__/local-3d-comfy.test.ts
@@ -37,7 +37,7 @@ vi.mock('../../api/dynamic-workflow', async (importOriginal) => ({
import {
comfyThreeDReady, runComfyThreeD, createThreeDProgress, threeDOutputFromHistory, threeDPhaseForNode,
} from '../local-3d-comfy'
-import { buildThreeDWorkflow, THREE_D_NODES, THREE_D_CUTOUT_NODES, THREE_D_SAVE_NODE } from '../../api/dynamic-workflow'
+import { buildThreeDWorkflow, THREE_D_NODES, THREE_D_CUTOUT_NODES, THREE_D_SAVE_NODE, THREE_D_NEEDS_UPDATE, WorkflowUnavailableError } from '../../api/dynamic-workflow'
import { TRELLIS2_FILES } from '../../api/model-bundles'
const ALL = Object.fromEntries([...THREE_D_NODES, ...THREE_D_CUTOUT_NODES].map((n) => [n, {}]))
@@ -159,6 +159,13 @@ describe('runComfyThreeD', () => {
await expect(run).rejects.toThrow('CUDA out of memory (KSampler)')
})
+ it('queues nothing on a ComfyUI too old for the graph, and says to update', async () => {
+ // A RemeshMesh without 'solid' (ComfyUI 0.36 to 0.41), found before the run.
+ buildLocalThreeDWorkflow.mockRejectedValue(new WorkflowUnavailableError(THREE_D_NEEDS_UPDATE, 'unavailable', undefined, { needsComfyUpdate: true }))
+ await expect(runComfyThreeD({ imageName: 'chair.png', detail: 'draft', cutout: false })).rejects.toThrow(THREE_D_NEEDS_UPDATE)
+ expect(submitWorkflow).not.toHaveBeenCalled()
+ })
+
it('a cancel takes only this prompt out of ComfyUI', async () => {
const ctl = new AbortController()
const run = runComfyThreeD({ imageName: 'chair.png', detail: 'draft', cutout: true, signal: ctl.signal })