Build and Debug a ComfyUI Workflow

Build, debug, and restore a local ComfyUI text-to-image workflow.

Introduction

30 Second Summary

Watching a written idea become an image can feel like magic. That magic turns into guesswork when the visual recipe breaks.

In this project, you will build a local ComfyUI workflow that turns a written scene into a saved image. You will expose its data flow by disconnecting one required link before repairing it.

What You'll Build

Picture your snowy mountain prompt becoming a finished illustration inside the Save Image node when you press Run.

By the end of this project, you'll have:

  • A local prompt-to-image workflow that turns your own scene description into a visible image you can save.
  • A typed link diagnosis that proves you can identify a missing KSampler input from visible graph feedback.
  • A seed-controlled workflow that can repeat a result or produce a fresh composition. Its saved workflow JSON can reopen the editable graph.
  • Secret Mission: Recover the complete graph from a generated PNG without loading the JSON. Use the recovered graph to produce a new variation.

Are there any prerequisites?

You'll need Ubuntu or Debian on x64 hardware with an NVIDIA GPU.

You'll need internet access for the initial downloads.

Leave enough free disk space for Comfy Desktop plus the model checkpoint.

Before We Start

Before any setup begins, this checkpoint locks in why you want to build and debug a local ComfyUI text-to-image workflow. You will learn how nodes move conditioning through typed links, how seeds control variations, and how workflow JSON plus PNG metadata preserve the editable graph.

Install Comfy Desktop and Create an Instance

Local image generation depends on a healthy hardware path before your workflow can run. An inactive NVIDIA driver changes which instance build your computer can use reliably.

Here, you'll check driver visibility before installing Comfy Desktop. You'll then create a stable ComfyUI instance with the matching hardware option.

In this step, get ready to:
  • Determine whether the NVIDIA driver is active.
  • Install Comfy Desktop 1.1.7 from the official Linux package.
  • Create a stable ComfyUI 0.40.0 instance.
Check the NVIDIA driver

The nvidia-smi command asks the active NVIDIA driver for information about your GPU. Its result determines which hardware build you select later.

Before you run the check, do you expect the terminal to display your NVIDIA GPU details?

  • Check whether the NVIDIA driver is active by running this command:
nvidia-smi

What does this command check?

The command reports the GPU hardware visible to the NVIDIA driver. A successful result includes GPU information plus driver details.

Comfy Desktop uses this evidence to guide your hardware selection. This keeps the instance aligned with the compute path your system can actually access.

✔️ I see GPU and driver details

Your NVIDIA driver is active. The later instance wizard should offer an NVIDIA build.

  • Record NVIDIA build as your hardware choice here: NVIDIA build or CPU fallback.

ⓧ The command fails

The CPU fallback keeps this project moving without a driver installation detour. Image generation can take longer on this path.

  • Record CPU fallback as your hardware choice here: NVIDIA build or CPU fallback.
Install Comfy Desktop from the official package

Ubuntu and Debian can install Comfy Desktop from its Linux .deb package. The official guide points to the current supported download.

This project uses Comfy Desktop 1.1.7. Choose the tab that matches your download.

✔️ The download completed

You have the current .deb package for Comfy Desktop 1.1.7. The package is ready for local installation.

ⓧ I have an older package

  • Return to the official Comfy Desktop Linux guide.
  • Use its universal download link to download version 1.1.7.

The newly downloaded .deb package is the one you use below.

ⓧ The download did not complete

  • Retry the universal download from the official Comfy Desktop Linux guide.

Wait until your browser shows that the .deb package has finished downloading.

The installation command searches the terminal's current folder for a downloaded .deb package. Your terminal therefore needs to start in the folder that contains the Comfy Desktop download.

  • Open your Linux file manager.
  • Navigate to the folder where your browser saved the Comfy Desktop .deb package.
  • Right-click an empty area inside that folder.
  • Choose the option that opens a terminal in the current folder.

The installer may ask for your Linux password. Your password authorizes the local package installation.

  • Install the downloaded Comfy Desktop package by running this command:
sudo apt install ./*.deb

What does this command do?

The sudo part grants administrator permission for the package installation. The apt part asks Ubuntu or Debian to install the package.

The ./*.deb pattern selects downloaded Debian packages in the current folder. This is why the terminal location matters.

  • Enter your Linux password if the terminal requests administrator approval.
  • Wait for the package installation to finish.

You'll see the terminal finish without an installation failure. Comfy Desktop is now available from your desktop's applications menu.

Package installation did not finish?

  • Confirm that the terminal is open in the folder containing the downloaded package.
  • Check that the downloaded filename ends with .deb.
  • Still stuck? Help me troubleshoot my Comfy Desktop package installation.
  • Click your Linux desktop's applications menu.
  • Search for Comfy Desktop.
  • Click the Comfy Desktop result to launch it.

Comfy Desktop opens to its instance chooser. You now have the application ready to create an isolated ComfyUI environment.

Create the stable ComfyUI instance

A Standalone instance includes its own Python environment. Comfy Desktop manages that environment separately from other software on your computer.

Why Comfy Desktop for this project?

A manual installation gives you deeper environment control. It also introduces GPU-specific dependency work before you can learn the workflow graph.

Comfy Desktop detects available hardware. It also creates the isolated environment for you.

  • Start the new-instance wizard from the Comfy Desktop chooser.
  • Select Public Builds as the instance source.
  • Keep Stable (Recommended) as the release channel.
  • In Hardware, select NVIDIA build or CPU fallback.
  • Select CPU if the wizard does not offer an NVIDIA build.
  • Confirm that the displayed ComfyUI version is 0.40.0.

The next stage downloads Python before setting up the instance environment. Expect this stage to take several minutes while Comfy Desktop prepares the local installation.

Before you start the installation, do you expect the selected build to open successfully on your chosen hardware path?

  • Begin the instance installation with the wizard's confirmation control.

When installation completes, you'll see the ComfyUI canvas or template library. The workspace should open without an installation error.

✔️ My instance opens

Comfy Desktop 1.1.7 is installed locally from the official Linux .deb package. The application is open.

Your ComfyUI 0.40.0 instance was created through Public Builds. It uses Stable (Recommended).

Your hardware selection follows the nvidia-smi result. The NVIDIA build is selected when GPU details appeared. The CPU option is selected when the driver check failed or the wizard could not detect NVIDIA.

ⓧ I see an installation error

Instance does not open?

  • Return to the Comfy Desktop instance chooser.
  • Restart the new-instance wizard.
  • Confirm that Public Builds is selected.
  • Confirm that Stable (Recommended) is selected.
  • Select CPU if the NVIDIA build remains unavailable.
  • Still stuck? Help me troubleshoot my ComfyUI instance installation.

That's the setup hurdle cleared. Next, you'll turn this empty workspace into your first generated image.

Generate Your First Image

Your ComfyUI instance now opens successfully. The next proof is a finished image generated on your own computer.

A checkpoint supplies the image model that the graph needs. In this step, you will add that model to the default workflow before turning two text prompts into your first result.

In this step, get ready to:
  • Load the default text-to-image workflow with its required checkpoint.
  • Set the positive prompt and negative prompt.
  • Generate an image before saving the original PNG locally.
Load the default workflow and checkpoint

The default workflow uses connected nodes to move information through each stage of image generation. Its Load Checkpoint node must point to a model before the graph can run.

  • Switch back to the ComfyUI instance from earlier.
  • Select the default text-to-image workflow if the template library is still open.

You should see Load Checkpoint, positive CLIP Text Encode, negative CLIP Text Encode, Empty Latent Image, KSampler, VAE Decode, and Save Image connected by visible links.

  • Check the current checkpoint value in the Load Checkpoint node.

The displayed value determines whether the model is already available or needs to be downloaded.

✔️ The checkpoint is already selected

The model library already contains v1-5-pruned-emaonly-fp16.safetensors. You can continue with the refresh below.

ⓧ The checkpoint is missing or null

A several-minute wait on a slower connection is normal for this checkpoint download.

  • Click View details in the missing-model banner.
  • Find v1-5-pruned-emaonly-fp16.safetensors in the Errors panel.
  • Click Download for the checkpoint.
  • Watch the download progress in the model panel.

The checkpoint is ready when the model panel shows that the download has completed.

  • Refresh the node definitions by pressing R.

The checkpoint list reloads with the newly downloaded model available.

  • Choose v1-5-pruned-emaonly-fp16.safetensors in the Load Checkpoint node.

The checkpoint selector should now display v1-5-pruned-emaonly-fp16.safetensors. It should no longer display null.

Checkpoint Still Missing?

  • Confirm that the model panel shows a completed download before refreshing the nodes.
  • Press R while no text field is focused.
  • Still stuck? Help me make the downloaded checkpoint appear in Load Checkpoint.
Set the positive and negative prompts

Positive conditioning describes the scene you want to generate. Negative conditioning lists features that the result should avoid.

  • Replace the text in the positive CLIP Text Encode node with a tiny glass observatory on a snowy mountain, sunrise, detailed illustration.
  • Replace the text in the negative CLIP Text Encode node with text, watermark, blurry.

The positive field now shows a tiny glass observatory on a snowy mountain, sunrise, detailed illustration. The negative field now shows text, watermark, blurry.

Run and save the image

The graph now has a selected model plus both text instructions. Running it tests whether every required node and link can complete the image-generation path.

Before you run the graph, pause to predict whether an image will reach the Save Image node.

  • Generate the image by clicking Run or pressing Ctrl + Enter.

Your first local generation is complete. You will see the finished observatory scene inside the Save Image node.

Image Not Appearing?

  • Confirm that Load Checkpoint still displays v1-5-pruned-emaonly-fp16.safetensors.
  • Click View details if ComfyUI marks a node or opens the error panel.
  • Still stuck? Help me troubleshoot my first ComfyUI image generation.
  • Save the generated image locally from the Save Image node as original-generated.png.

You should now have original-generated.png in the local folder you selected.

Why Keep the Original PNG?

The built-in Save Image node stores complete workflow metadata inside its output by default. Keeping the original file preserves the visual recipe for later recovery.

Your local image workflow now has a working model and a saved result. Next, you will test how much the graph depends on one required connection.

Break the Workflow on Purpose

Your first image proves your local ComfyUI workflow can carry data through a connected graph. However, a working template hides how fragile that data flow becomes when one required connection disappears.

You will first trace the positive conditioning path. Then you will disconnect it to see how the graph reports missing data.

In this step, get ready to:
  • Trace positive conditioning into KSampler.
  • Disconnect KSampler's required positive input.
  • Run the graph to reveal its missing-input feedback.
Trace the conditioning path

ComfyUI nodes exchange values through typed links. Each link can connect only compatible data types.

The orange wire carries the positive CONDITIONING value from CLIP Text Encode to KSampler. Following that wire shows where your written prompt enters the sampling stage.

  • Return to the ComfyUI canvas from earlier.
  • Find the positive CLIP Text Encode node containing a tiny glass observatory on a snowy mountain, sunrise, detailed illustration.
  • Locate the orange CONDITIONING output on the right edge of the node.
  • Trace the orange link to the positive input on KSampler.

You will see the wire finish at KSampler's orange positive endpoint. The matching colors show that both ports carry compatible data.

Disconnect the required input

A required input supplies data that a node needs before it can run. Removing the positive link creates a controlled test of KSampler's dependency on the prompt.

  • Hold the left mouse button down on KSampler's orange positive input endpoint.
  • Drag the endpoint away from KSampler while keeping the button pressed.
  • Release the left mouse button over an empty part of the canvas.

You will see the orange wire disappear from KSampler's positive input. The graph now has a visible gap in its conditioning path.

Before you run the altered graph, do you think KSampler can still generate an image without positive conditioning?

  • Run the altered workflow by clicking Run or pressing Ctrl + Enter.

This Failure Is Intentional

Generation does not complete. You will see KSampler marked because its required positive input is missing.

Equivalent feedback may appear in the Errors panel. This is the intended shortfall.

You have now proved that the prompt reaches KSampler through a required typed connection.

Workflow Still Completes?

  • Check that no orange link enters KSampler's positive input.
  • Run the altered workflow once more by clicking Run.
  • Still stuck? Help me check why my disconnected ComfyUI workflow still appears to run.

You have exposed the graph's missing dependency by making execution stop where the data path breaks. Next, you will restore the link before exploring repeatable image variations.

Repair the Graph and Control Variations

Your previous run exposed the exact gap this step fixes. ComfyUI blocked KSampler because the required positive conditioning data had no path into the sampler.

This step restores the typed link so the graph can run again. The seed controls then let you compare repeatable output with a randomized variation.

In this step, get ready to:
  • Reconnect the positive conditioning link.
  • Generate two repeatable images with the same seed.
  • Generate a randomized image with a changed seed.
Reconnect the positive conditioning link

Links carry typed data between nodes. KSampler can run after its orange positive input receives CONDITIONING data again.

  • Locate the orange CONDITIONING output on the positive CLIP Text Encode node.
  • Drag from that orange output to the orange positive input on KSampler.
  • Confirm that the orange link now joins the two endpoints.

Before you test the repair, do you expect the graph to complete this time?

  • Run the repaired graph by pressing Ctrl + Enter.

The missing-input marker clears from KSampler. You’ll see a completed image in the Save Image node.

You have repaired the exact data path that stopped the sampler.

Graph Still Blocked?

  • Check that the wire starts from the positive CLIP Text Encode node.
  • Check that the orange wire ends at the positive input on KSampler.
  • Still blocked? Help me repair the positive conditioning link.
Prove the seed can repeat an image

A seed sets the starting noise used by KSampler. The same seed supports repeatable results when the rest of the graph stays unchanged.

Your positive prompt remains a tiny glass observatory on a snowy mountain, sunrise, detailed illustration. Your negative prompt remains text, watermark, blurry.

  • Choose Keep for control_after_generate in KSampler.
  • Record the numeric seed here: your numeric KSampler seed.

Before the first run, do you expect Keep to preserve the composition after a second run?

  • Generate the first repeatable output by pressing Ctrl + Enter.

You’ll see the first result in the Save Image node.

  • Save the first output locally from the Save Image node.
  • Generate the second repeatable output by pressing Ctrl + Enter.

You’ll see the same composition because the seed stayed fixed.

  • Save the second output locally from the Save Image node.
  • Compare the two saved outputs side by side.

The repeatable pair gives you a controlled baseline for the randomized run.

Outputs Do Not Match?

  • Confirm that control_after_generate still shows Keep.
  • Confirm that the current seed still matches your numeric KSampler seed.
  • Need help comparing the runs? Help me find why my repeated outputs differ.
Create a randomized variation

Setting control_after_generate to Random changes the seed for another run. The new starting noise can produce a different composition from the same prompts.

  • Choose Random for control_after_generate in KSampler.

Before you run the graph, how do you expect the new seed to affect the composition?

  • Generate the randomized variation by pressing Ctrl + Enter.

The numeric seed changes from your numeric KSampler seed. You’ll see a different composition in the Save Image node.

  • Compare the randomized preview with the repeatable pair.
  • Save the randomized output locally from the Save Image node.

Seed Did Not Change?

  • Confirm that control_after_generate shows Random before the run.
  • Compare the current numeric seed with your numeric KSampler seed.
  • Still seeing the old seed? Help me troubleshoot KSampler seed randomization.

Your randomized output now sits beside the repeatable pair. You can prove which part of the graph controls variation.

Your graph runs again with a repaired conditioning link. Next up, you’ll save its editable layout so the workflow can survive a cleared canvas.

Save and Reload Your Workflow

Your repaired ComfyUI graph runs successfully again. However, a workflow that exists only on the current canvas is easy to lose.

Now you'll save the graph as an editable JSON file. You will clear the canvas before proving that the saved file restores a working workflow.

In this step, get ready to:
  • Save the working graph as an editable workflow file.
  • Remove the active graph from the canvas.
  • Restore the saved graph to generate another image.
Save the editable workflow

A workflow file preserves the visual recipe behind your image. It stores the node layout, links, prompts, KSampler settings, and widget values.

  • Open the workflow save dialog by pressing Ctrl + S.
  • Choose a folder where you want to store the workflow.
  • Record the selected folder here: your workflow folder.
  • Enter comfyui-text-to-image-workflow.json as the filename.
  • Click Save.

That is a solid safety net: your working graph now has an editable recovery file.

What Does the Workflow File Preserve?

The workflow file records where each node sits and how the nodes connect.

It also stores your prompts and widget values. This includes the current control_after_generate setting in KSampler.

Workflow File Not Appearing?

  • Press Ctrl + S again to reopen the save dialog.
  • Confirm that the filename ends with .json.
  • Check the folder recorded as your workflow folder.
  • Still stuck? Help me find my saved ComfyUI workflow file.
Clear the active canvas

Clearing the canvas looks drastic because every node disappears at once. Your saved workflow file gives you a recovery point for the complete graph.

  • Click an empty area of the canvas so no text field has focus.
  • Clear the workflow by pressing Backspace.

You should see an empty canvas with the text-to-image nodes removed. This confirms that the next result must come from the saved workflow file.

Nodes Still on the Canvas?

  • Click a blank area of the canvas to move focus away from any text field.
  • Press Backspace again.
  • Still stuck? Help me clear my ComfyUI canvas safely.
Reload and test the saved workflow

Loading the saved file should rebuild the editable canvas from its stored layout and settings. The restored graph must still contain every required link before it can generate an image.

  • Open the workflow load dialog by pressing Ctrl + O.
  • Navigate to your workflow folder.
  • Select comfyui-text-to-image-workflow.json.
  • Click Open.
  • Confirm that the restored canvas contains Load Checkpoint, both CLIP Text Encode nodes, Empty Latent Image, KSampler, VAE Decode, and Save Image.
  • Confirm that the positive prompt reads a tiny glass observatory on a snowy mountain, sunrise, detailed illustration.
  • Confirm that the negative prompt reads text, watermark, blurry.
  • Trace the required links into KSampler to confirm that the orange CONDITIONING link reaches its positive input.

One prediction matters before the run: whether the saved file can reproduce the complete data flow after the canvas was empty.

  • Run the restored workflow by pressing Ctrl + Enter.

You should see generation complete with an image inside the Save Image node. You have proved that comfyui-text-to-image-workflow.json restores an executable graph.

Restored Graph Not Running?

  • Confirm that you loaded comfyui-text-to-image-workflow.json.
  • Check that Load Checkpoint has v1-5-pruned-emaonly-fp16.safetensors selected.
  • Press R if the checkpoint field displays null.
  • Inspect the orange CONDITIONING link into KSampler if ComfyUI marks a missing required input.
  • Still stuck? Help me diagnose my restored ComfyUI workflow.

Secret mission

Recover a Workflow From Its Image

Recover the complete text-to-image graph from your original generated PNG without loading the saved JSON. Change the recovered prompt while keeping the seed fixed, then generate a new variation from the image's embedded recipe.

Clean Up Your Resources

Clean Up Your Resources

Your workflow runs locally, so there is no usage-based software charge. Choose whether to keep your ComfyUI instance ready, close the running apps for now, or remove the resources that consume disk space.

Resources you used:

  • The ComfyUI 0.40.0 stable instance managed through Comfy Desktop.
  • The Stable Diffusion 1.5 checkpoint named v1-5-pruned-emaonly-fp16.safetensors.
  • The editable workflow JSON file named comfyui-text-to-image-workflow.json.
  • The locally saved PNG outputs, including original-generated.png, randomized-output.png, recovered-workflow-variation.png, plus the two repeatable output images.

Keep everything running

No action is needed. This option keeps the recovered graph ready for another image generation session.

  • The ComfyUI 0.40.0 stable instance remains available through Comfy Desktop.
  • The v1-5-pruned-emaonly-fp16.safetensors checkpoint stays in the local model library.
  • The comfyui-text-to-image-workflow.json file remains available for restoring the editable graph.
  • Your original, repeatable, randomized, plus recovered-workflow images remain in their local save locations.

Pause - I'll come back to this later

Pausing stops local image generation while leaving the instance, checkpoint, workflow, plus images ready for another session.

  • Close the ComfyUI window.
  • Close Comfy Desktop.

Your local image generation is now stopped. The instance, checkpoint, JSON file, plus PNG files stay on disk for your next session.

Delete - I don't want to use this again

This option removes the standalone instance, shared checkpoint, workflow JSON, plus generated images. Comfy Desktop remains installed.

Deleting the standalone instance is permanent. Your saved JSON and PNG files remain untouched until you remove them separately.

  • Return to the Comfy Desktop chooser.
  • Open the three-dot menu on the ComfyUI 0.40.0 stable instance card.
  • Select Uninstall to permanently delete the standalone instance.

The standalone instance is now removed from Comfy Desktop. Its shared checkpoint remains available until you clean it up separately.

  • Select the Storage tab in Comfy Desktop.
  • Locate the active shared model directory shown in the Storage tab.
  • Delete v1-5-pruned-emaonly-fp16.safetensors only if no other instance needs it.
  • Delete comfyui-text-to-image-workflow.json from the local location you selected.
  • Delete original-generated.png, randomized-output.png, recovered-workflow-variation.png, plus the two repeatable output images from the locations you selected.

A final check confirms that the project resources no longer occupy local disk space.

  • Confirm the ComfyUI 0.40.0 stable instance card no longer appears in the chooser.
  • Confirm v1-5-pruned-emaonly-fp16.safetensors no longer appears in the active shared model directory.
  • Confirm comfyui-text-to-image-workflow.json no longer appears in its local save location.
  • Confirm the generated PNG outputs no longer appear in their local save locations.

Nice Work!

Nice Work!

That’s a wrap! You built a local ComfyUI workflow that turns a written scene into a saved image.

You’ve learned how to:

  • Generate a visible image with a text-to-image graph. Trace its data flow from the checkpoint through conditioning, latent sampling, decoding, and output.
  • Create a designed missing-input failure by disconnecting KSampler’s positive input. Repair the typed CONDITIONING link to restore generation.
  • Control repeatable and randomized results with KSampler’s seed settings. Save the editable graph as comfyui-text-to-image-workflow.json. Reload it onto a cleared canvas to prove it still runs.
  • Complete the optional Secret Mission by recovering the full graph from original-generated.png. Change its prompt while keeping the seed fixed. Produce recovered-workflow-variation.png without loading the saved workflow file.

Ready to quiz yourself?