{"record":{"id":"343cceaf1a96e812","repo":"Comfy-Org/ComfyUI","slug":"task-creation-failed-with-code-initial-res-code","errorCode":null,"errorMessage":"Task creation failed with code {initial_res.code}: {initial_res.message}","messagePattern":"Task creation failed with code (.+?): (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_hitpaw.py","lineNumber":171,"sourceCode":"                raise ValueError(\n                    f\"Output size ({output_width}x{output_height} = {output_pixels:,} pixels) \"\n                    f\"exceeds maximum allowed size of {MAX_PIXELS_GENERATIVE:,} pixels ({MAX_MP_GENERATIVE}MP). \"\n                    f\"Enable auto_downscale or use a smaller input image or a lower upscale factor.\"\n                )\n\n        initial_res = await sync_op(\n            cls,\n            ApiEndpoint(path=\"/proxy/hitpaw/api/photo-enhancer\", method=\"POST\"),\n            response_model=TaskCreateResponse,\n            data=ImageEnhanceTaskCreateRequest(\n                model_name=f\"{model}_{upscale_factor}x\",\n                img_url=await upload_image_to_comfyapi(cls, image, total_pixels=None),\n            ),\n            wait_label=\"Creating task\",\n            final_label_on_success=\"Task created\",\n        )\n        if initial_res.code != 200:\n            raise ValueError(f\"Task creation failed with code {initial_res.code}: {initial_res.message}\")\n        request_price = initial_res.data.consume_coins / 1000\n        final_response = await poll_op(\n            cls,\n            ApiEndpoint(path=\"/proxy/hitpaw/api/task-status\", method=\"POST\"),\n            data=TaskCreateDataResponse(job_id=initial_res.data.job_id),\n            response_model=TaskStatusResponse,\n            status_extractor=lambda x: x.data.status,\n            price_extractor=lambda x: request_price,\n            poll_interval=10.0,\n        )\n        return IO.NodeOutput(await download_url_to_image_tensor(final_response.data.res_url))\n\n\nclass HitPawVideoEnhance(IO.ComfyNode):\n    @classmethod\n    def define_schema(cls):\n        model_options = []\n        for model_name in VIDEO_MODELS_MODELS_MAP:","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_hitpaw.py#L153-L189","documentation":"Thrown by Hitpaw photo enhancement when the task-creation POST to /proxy/hitpaw/api/photo-enhancer returns a non-200 business code. The proxy call itself succeeded (TaskCreateResponse parsed); Hitpaw rejected the job — the message embeds both the numeric code and Hitpaw's message field.","triggerScenarios":"Hitpaw-side rejection: insufficient coins for the selected model/scale, model_name combination invalid server-side (model_xX string not recognized), or transient provider errors surfaced through the proxy.","commonSituations":"Out-of-balance ComfyAPI/Hitpaw credits; provider model catalog changes renaming models; rare provider 5xx mapped to a non-200 code.","solutions":["Match the numeric code/message against Hitpaw's API error table embedded in the message (credit errors are the most common)","Top up credits / verify the ComfyAPI partner billing for Hitpaw","Retry once — transient provider rejections often clear","If the model name is rejected, update ComfyUI so the model widget emits current model ids"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    out = await enhance_photo(...)\nexcept ValueError as e:\n    if 'Task creation failed with code' in str(e):\n        # parse code from message; credit errors need top-up, transient ones a retry\n        raise","preventionTips":["Keep Hitpaw/ComfyAPI credit balance topped up — it is the dominant failure cause","Run one small job first to validate the model/scale combination before batches"],"tags":["hitpaw","task-creation","credits","provider-error"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}