Comfy-Org/ComfyUI · error · ValueError
INVALID_BODY
INVALID_BODY
Error message
uploads require exactly one destination role: input, models, or output
What it means
Raised by resolve_destination_from_tags when the tag list does not contain exactly one destination role from {'input','models','output'}. Tags are the only routing signal for upload destinations: zero roles means the server cannot pick a base directory, two or more are ambiguous. ValueError here surfaces to the caller as INVALID_BODY.
Source
Thrown at app/assets/services/path_utils.py:40
targets: list[tuple[str, list[str], set[str]]] = []
for name, values in folder_paths.folder_names_and_paths.items():
if name in _NON_MODEL_FOLDER_NAMES:
continue
paths, exts = values[0], values[1]
if paths:
targets.append((name, paths, set(exts)))
return targets
def resolve_destination_from_tags(tags: list[str]) -> tuple[str, list[str]]:
"""Validates and maps upload routing tags -> (base_dir, subdirs_for_fs).
The request tags are only used to choose the write destination. Extra tags
remain labels; they do not become path components or trusted classification.
"""
destination_roles = [t for t in tags if t in {"input", "models", "output"}]
if len(destination_roles) != 1:
raise ValueError("uploads require exactly one destination role: input, models, or output")
root = destination_roles[0]
if root == "models":
model_type_tags = [t for t in tags if t.startswith("model_type:")]
if len(model_type_tags) != 1:
raise ValueError("models uploads require exactly one model_type:<folder_name> tag")
folder_name = model_type_tags[0].split(":", 1)[1]
if not folder_name:
raise ValueError("models uploads require exactly one model_type:<folder_name> tag")
model_folder_paths = {
name: paths for name, paths, _exts in get_comfy_models_folders()
}
try:
bases = model_folder_paths[folder_name]
except KeyError:
raise ValueError(f"unknown model category '{folder_name}'")
if not bases:
raise ValueError(f"no base path configured for category '{folder_name}'")View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Send exactly one of 'input', 'models', or 'output' in the tags array, plus any extra label tags you want.
- Validate the tag list client-side before upload: exactly one role, and for 'models' exactly one model_type:<folder> tag.
- If your workflow needs bytes in two destinations, perform two uploads (or a copy operation), not one multi-role upload.
Example fix
# before tags = ['input', 'output', 'my-label'] # after tags = ['input', 'my-label']
Defensive patterns
Strategy: validation
Validate before calling
ROLES = {'input', 'models', 'output'}
def valid_upload_tags(tags: list[str]) -> bool:
roles = [t for t in tags if t in ROLES]
if len(roles) != 1:
return False
if roles[0] == 'models':
mt = [t for t in tags if t.startswith('model_type:')]
if len(mt) != 1 or not mt[0].split(':', 1)[1]:
return False
return True Prevention
- Exactly one role tag per upload; treat it as a required form field
- For 'models', add exactly one non-empty model_type:<folder> tag
- Run the same count checks client-side that the server performs
When it happens
Trigger: POST an upload with tags=['user:alice'] (no role), or tags=['input','output'] (two roles). Both fail the len(destination_roles) != 1 check.
Common situations: Clients that send freeform/label tags only; UI that lets users multi-select destinations; copy-paste of example tag lists that include several roles; legacy clients hardcoding 'output' while the server adds 'input'.
Related errors
- INVALID_BODY
- INVALID_BODY
- destination escapes base directory
- Path is not within input, output, temp, or configured model
- Video duration ({actual_duration:.2f}s) exceeds the maximum
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/ef9c54f68a4ee24a.
Report an issue: GitHub.