Comfy-Org/ComfyUI · error · ValueError
Task creation failed with code {initial_res.code}: {initial_
Error message
Task creation failed with code {initial_res.code}: {initial_res.message} What it means
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.
Source
Thrown at comfy_api_nodes/nodes_hitpaw.py:171
raise ValueError(
f"Output size ({output_width}x{output_height} = {output_pixels:,} pixels) "
f"exceeds maximum allowed size of {MAX_PIXELS_GENERATIVE:,} pixels ({MAX_MP_GENERATIVE}MP). "
f"Enable auto_downscale or use a smaller input image or a lower upscale factor."
)
initial_res = await sync_op(
cls,
ApiEndpoint(path="/proxy/hitpaw/api/photo-enhancer", method="POST"),
response_model=TaskCreateResponse,
data=ImageEnhanceTaskCreateRequest(
model_name=f"{model}_{upscale_factor}x",
img_url=await upload_image_to_comfyapi(cls, image, total_pixels=None),
),
wait_label="Creating task",
final_label_on_success="Task created",
)
if initial_res.code != 200:
raise ValueError(f"Task creation failed with code {initial_res.code}: {initial_res.message}")
request_price = initial_res.data.consume_coins / 1000
final_response = await poll_op(
cls,
ApiEndpoint(path="/proxy/hitpaw/api/task-status", method="POST"),
data=TaskCreateDataResponse(job_id=initial_res.data.job_id),
response_model=TaskStatusResponse,
status_extractor=lambda x: x.data.status,
price_extractor=lambda x: request_price,
poll_interval=10.0,
)
return IO.NodeOutput(await download_url_to_image_tensor(final_response.data.res_url))
class HitPawVideoEnhance(IO.ComfyNode):
@classmethod
def define_schema(cls):
model_options = []
for model_name in VIDEO_MODELS_MODELS_MAP:View on GitHub (pinned to 1c6d8d45b3)
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
Defensive patterns
Strategy: try-catch
Try / catch
try:
out = await enhance_photo(...)
except ValueError as e:
if 'Task creation failed with code' in str(e):
# parse code from message; credit errors need top-up, transient ones a retry
raise Prevention
- 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
When it happens
Trigger: 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.
Common situations: Out-of-balance ComfyAPI/Hitpaw credits; provider model catalog changes renaming models; rare provider 5xx mapped to a non-200 code.
Related errors
- Output size ({output_width}x{output_height} = {output_pixels
- Selected resolution {resolution} ({target_size}x{target_size
- Selected resolution {resolution} ({target_size}p) is smaller
- Kling initial request failed. Code: {response.code}, Message
- Kling 3.0 Turbo create failed. Code: {create.code}, Message:
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/343cceaf1a96e812.
Report an issue: GitHub.