{"record":{"id":"75231d074fa0aa49","repo":"calesthio/OpenMontage","slug":"prompt-error-json-dumps-data-error","errorCode":null,"errorMessage":"Prompt error: {json.dumps(data['error'])}","messagePattern":"Prompt error: (.+?)","errorType":"exception","errorClass":"ComfyUIError","httpStatus":null,"severity":"error","filePath":"tools/_comfyui/client.py","lineNumber":192,"sourceCode":"    # ------------------------------------------------------------------\n    # Core cycle\n    # ------------------------------------------------------------------\n\n    def submit(self, workflow: dict) -> str:\n        \"\"\"Queue a workflow for execution.  Returns the ``prompt_id``.\"\"\"\n        resp = requests.post(\n            f\"{self.server_url}/prompt\",\n            json={\"prompt\": workflow, \"client_id\": self.client_id},\n            timeout=30,\n        )\n        try:\n            data = resp.json()\n        except ValueError:\n            data = {}\n        if data.get(\"node_errors\"):\n            raise ComfyUIError(f\"Node errors: {json.dumps(data['node_errors'])}\")\n        if data.get(\"error\"):\n            raise ComfyUIError(f\"Prompt error: {json.dumps(data['error'])}\")\n        resp.raise_for_status()\n        prompt_id = data.get(\"prompt_id\")\n        if not prompt_id:\n            raise ComfyUIError(f\"No prompt_id in response: {data}\")\n        return prompt_id\n\n    def poll(\n        self,\n        prompt_id: str,\n        *,\n        timeout: int = 600,\n        interval: int = 5,\n    ) -> dict:\n        \"\"\"Block until *prompt_id* finishes.  Returns the history entry.\"\"\"\n        deadline = time.time() + timeout\n        while time.time() < deadline:\n            entry = self._history_entry(prompt_id)\n            if entry is not None:","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/_comfyui/client.py#L174-L210","documentation":"ComfyUIError raised when the /prompt response contains a top-level error object (distinct from per-node node_errors). This is ComfyUI rejecting the prompt as a whole — commonly malformed workflow structure, an unserializable value, or an execution-type error during prompt preparation. The raw error JSON is embedded for diagnosis. Like node_errors, this fires before queueing.","triggerScenarios":"submit() posts a workflow whose top-level structure is wrong (not a dict of node ids, bad edge format), a node type string that doesn't exist on the server at all, or ComfyUI returns a validation error object from its /prompt handler.","commonSituations":"Submitting a UI-format workflow (with 'links' arrays) instead of API-format (prompt) JSON; workflow exported from a newer ComfyUI submitted to an older server; a typo'd class_type; server plugin disabled mid-session.","solutions":["Confirm you are submitting API-format workflow JSON (nodes keyed by id with class_type and inputs), not the UI export format","Read the embedded error JSON — 'type'/'message' identify the exact structural problem","Re-export the workflow from the target server via 'Save (API Format)' and resubmit","If a node type is unknown, install the matching custom node or remove the node from the workflow"],"exampleFix":"# before\nworkflow = json.load(open('workflow_ui.json'))  # UI format, has \"links\"\nprompt_id = client.submit(workflow)\n\n# after\nworkflow = json.load(open('workflow_api.json'))  # API format\nprompt_id = client.submit(workflow)","handlingStrategy":"validation","validationCode":"def is_api_format(workflow: dict) -> bool:\n    if not isinstance(workflow, dict) or not workflow:\n        return False\n    return all(\n        isinstance(v, dict) and \"class_type\" in v and \"inputs\" in v\n        for v in workflow.values()\n    )\nif not is_api_format(workflow):\n    raise SystemExit(\"workflow is not API-format (contains UI 'links' export?)\")","typeGuard":"def is_api_format(workflow: dict) -> bool:\n    return (\n        isinstance(workflow, dict)\n        and bool(workflow)\n        and all(isinstance(v, dict) and \"class_type\" in v for v in workflow.values())\n    )","tryCatchPattern":"try:\n    prompt_id = client.submit(workflow)\nexcept ComfyUIError as e:\n    if \"Prompt error\" in str(e):\n        raise SystemExit(f\"server rejected the prompt wholesale: {e}\")\n    raise","preventionTips":["Never submit UI-format ('Save') exports; always 'Save (API Format)'","Verify class_type strings against the target server","Keep a lint step that checks workflow structure before submission"],"tags":["comfyui","workflow-validation","api-client"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}