Skip to content

Conversation

saurabh-pingale
Copy link
Contributor

Closes #9076

This pull request introduces a new API endpoint, validate_prompt, to validate the structure and integrity of a ComfyUI workflow prompt without executing it.

What does this PR do?

  • Adds a POST /validate_prompt endpoint that accepts a JSON workflow prompt.
  • The endpoint checks for:
    - Missing required input for all nodes.
    - Invalid values (e.g. ckpt_name that doesn't exist).
    - Incorrectly linked nodes or data types.
  • It returns JSON response with "valid": true for a correct prompt or "valid": false along with a node_erros object detailing the specified issues.

Why is this change needed?

Currently, the only way to know if a prompt is valid is to queue it for execution. This is inefficient for both the client and server. This new endpoint provides a quick, lightweight method to pre-validate prompts, improving the user experience and reducing the server load from failed runs.

Testing & Verification
The endpoint has been tested for both valid and invalid workflow scenarios using Postman.

Valid Workflow Response
Below is the Postman screenshot showing successful for a correctly structured workflow. The API returns 200 OK with "valid": true.

Screenshot 2025-08-21 164148

Invalid Workflow Response
To ensure robust error handling, an invalid workflow was tested by removing the required positive input from the KSampler node. The API correctly identifies the error, returning a 400 Bad Request with "valid": false and a detailed error message.

Screenshot 2025-08-21 164329

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

POST validation
1 participant