Skip to content

Adjust the logic in handleFile function of app.ts #6988

@mirabarukaso

Description

@mirabarukaso

Prerequisites

  • I am running the latest version of ComfyUI
  • I have searched existing issues to make sure this isn't a duplicate
  • I have tested with all custom nodes disabled (see how)

What happened?

In the current logic, the parameters are positioned too early. This causes images saved using the Image Saver node with A1111 compatibility to fail to load the workflow correctly. Since the code first detects the presence of the parameters, it attempts to read them in A1111 compatibility mode instead of using the prompt correctly to load the workflow.

It is recommended that the priority of parameters is lowered to the very end so that compatibility mode is only used for evaluation if all preceding checks fail.

I traced back through the versions and discovered that, although this issue has probably been present for long time, bug it appeared after today I updated to latest ComfyUI.

async handleFile(file: File, openSource?: WorkflowOpenSource) {

  async handleFile(file: File, openSource?: WorkflowOpenSource) {
    const fileName = file.name.replace(/\.\w+$/, '') // Strip file extension
    const workflowData = await getWorkflowDataFromFile(file)
    if (!workflowData) {
      this.showErrorOnFileLoad(file)
      return
    }

    const { workflow, prompt, parameters, templates } = workflowData

    if (templates) {
      this.loadTemplateData({ templates })
    }

    if (workflow) {
      const workflowObj =
        typeof workflow === 'string' ? JSON.parse(workflow) : workflow
      await this.loadGraphData(workflowObj, true, true, fileName, {
        openSource
      })
      return
    }

    if (prompt) {
      const promptObj = typeof prompt === 'string' ? JSON.parse(prompt) : prompt
      this.loadApiJson(promptObj, fileName)
      return
    }
	
	if (parameters) {
      // Note: Not putting this in `importA1111` as it is mostly not used
      // by external callers, and `importA1111` has no access to `app`.
      useWorkflowService().beforeLoadNewGraph()
      importA1111(this.graph, parameters)
      useWorkflowService().afterLoadNewGraph(
        fileName,
        this.graph.serialize() as unknown as ComfyWorkflowJSON
      )
      return
    }

    this.showErrorOnFileLoad(file)
  }

Steps to Reproduce

  1. Update to latest start comfyui
  2. Load 2025-11-27-150211_3065179543.png in to comfyui
  3. Shows the A1111 workflow
  4. Load 2025-11-27-150211_3065179543 - Copy.png which has simply change parameters in tExt to marameters
  5. Shows the correct workflow
Image Image

Incorrect Workflow

2025-11-27-150211_3065179543.png
2025-11-27-150211_3065179543.png

Image

Correct Workflow

2025-11-27-150211_3065179543 - Copy.png
2025-11-27-150211_3065179543 - Copy.png

Image

How is this affecting you?

Feature doesn't work as expected

ComfyUI Frontend Version

1.34.0

Browser

Edge

Console Errors

Logs

System Info

Checkpoint files will always be loaded safely.
Total VRAM 24576 MB, total RAM 130756 MB
pytorch version: 2.9.0+cu130
Enabled fp16 accumulation.
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA TITAN RTX : cudaMallocAsync
Enabled pinned memory 58840.0
working around nvidia conv3d memory bug.
Using sage attention
Python version: 3.13.9 (tags/v3.13.9:8183fa5, Oct 14 2025, 14:09:13) [MSC v.1944 64 bit (AMD64)]
ComfyUI version: 0.3.75
ComfyUI frontend version: 1.34.0
[Prompt Server] web root: C:\Users\oOkami\AppData\Roaming\Python\Python313\site-packages\comfyui_frontend_package\static
Total VRAM 24576 MB, total RAM 130756 MB
pytorch version: 2.9.0+cu130
Enabled fp16 accumulation.
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA TITAN RTX : cudaMallocAsync
Enabled pinned memory 58840.0

Additional Context

No response

┆Issue is synchronized with this Notion page by Unito

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions