Comfyui-FlowChain icon indicating copy to clipboard operation
Comfyui-FlowChain copied to clipboard

error load workflow.json

Open SaiZyca opened this issue 4 months ago • 5 comments

Try a very simple workflow bud not work, Could you provide a simple example to illustrate how to connect them?

Image Image

SaiZyca avatar Aug 06 '25 10:08 SaiZyca

I'm having the same exact issue on two different workflows. On my side this issue happens when I'm decoding a .json workflow to load it into another workflow.

When calling the json.loads function to assign it's output to the workflow, I noticed that my value "workflows" in workflows.py for the function "get_recursive_workflow" is an empty str.

Here's my traceback if it can help:

!!! Exception during processing !!! Error while loading workflow: Pair Characters.json, See <a href='https://github.com/numz/Comfyui-FlowChain'> for more information.
Traceback (most recent call last):
  File "F:\AI\Images\ComfyUI\ComfyUI\custom_nodes\Comfyui-FlowChain\workflow.py", line 387, in get_recursive_workflow
    workflow = json.loads(workflows)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "F:\AI\Images\ComfyUI\ComfyUI\execution.py", line 496, in execute
    output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs)
  File "F:\AI\Images\ComfyUI\ComfyUI\execution.py", line 315, in get_output_data
    return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs)
  File "F:\AI\Images\ComfyUI\ComfyUI\custom_nodes\comfyui-lora-manager\py\metadata_collector\metadata_hook.py", line 165, in async_map_node_over_list_with_metadata
    results = await original_map_node_over_list(
  File "F:\AI\Images\ComfyUI\ComfyUI\execution.py", line 289, in _async_map_node_over_list
    await process_inputs(input_dict, i)
  File "F:\AI\Images\ComfyUI\ComfyUI\execution.py", line 277, in process_inputs
    result = f(**inputs)
  File "F:\AI\Images\ComfyUI\ComfyUI\custom_nodes\Comfyui-FlowChain\workflow.py", line 457, in generate
    workflow, _, _ = get_recursive_workflow(workflows, workflow, 5000, [])
  File "F:\AI\Images\ComfyUI\ComfyUI\custom_nodes\Comfyui-FlowChain\workflow.py", line 389, in get_recursive_workflow
    raise RuntimeError(f"Error while loading workflow: {workflow_name}, See <a href='https://github.com/numz/Comfyui-FlowChain'> for more information.")
RuntimeError: Error while loading workflow: Pair Characters.json, See <a href='https://github.com/numz/Comfyui-FlowChain'> for more information.```

tomwongs avatar Aug 06 '25 11:08 tomwongs

Same problem, tried to fix it but with no luck. I seems there is an error while trying to parse the .json workflow.

Zanigets avatar Aug 22 '25 10:08 Zanigets

same question

springjk avatar Aug 27 '25 12:08 springjk

The extension was failing with JSONDecodeError: Expecting value: line 1 column 1 (char 0) because newer ComfyUI versions (post 0.3.33) changed the workflow save format from "API format" to "standard format" with a nodes array. The extension expected the old flat dictionary format but received the new structured format, causing JSON parsing to fail.

Solution is to modify workflow.py to work with newer format.

workflow.py

You can download it and replace old file in custom nodes folder. Let me know if this works.

Zanigets avatar Aug 27 '25 14:08 Zanigets

The file provided by Zanigets didn't worked on my end, still had this issue on line 139-140 of workflow.py, for the "populate_inputs" and gave this error

Image

The workflow loaded now, but was checking the type of the defaults with the old format, so I changed this line (139-140);

workflow_inputs_images = {k: v for k, v in workflow.items() if "class_type" in v and
                                      v["class_type"] == "WorkflowInput" and v["inputs"]["type"] == "IMAGE"}

For this one;

workflow_inputs_images = {k: v for k, v in workflow.items() if "class_type" in v and
                                      v["class_type"] == "WorkflowInput" and type(v["inputs"]["default"]) is torch.Tensor}

But now it passes through the values we give in the current workflow to the workflow chain, but the workflow chain does not output the values happening inside it.

Examples

Situation 1

test.json workflow Image

current workflow Image

Situation 2

test.json workflow Image

current workflow Image

Image

tomwongs avatar Aug 30 '25 22:08 tomwongs