ultralytics/yolov5 · error · RuntimeError
No inputs provided.
Error message
No inputs provided.
What it means
Raised by TritonClient._create_inputs (utils/triton.py) when the model wrapper's __call__ receives neither positional args nor keyword args. The wrapper builds Triton inference input tensors from exactly one of *args or **kwargs; an empty call gives it nothing to serialize and send, so it fails fast before contacting the server.
Source
Thrown at utils/triton.py:64
def __call__(self, *args, **kwargs) -> torch.Tensor | tuple[torch.Tensor, ...]:
"""Invokes the model.
Parameters can be provided via args or kwargs. args, if provided, are assumed to match the order of inputs of
the model. kwargs are matched with the model input names.
"""
inputs = self._create_inputs(*args, **kwargs)
response = self.client.infer(model_name=self.model_name, inputs=inputs)
result = []
for output in self.metadata["outputs"]:
tensor = torch.as_tensor(response.as_numpy(output["name"]))
result.append(tensor)
return result[0] if len(result) == 1 else result
def _create_inputs(self, *args, **kwargs):
"""Creates input tensors from args or kwargs, not both; raises error if none or both are provided."""
args_len, kwargs_len = len(args), len(kwargs)
if not args_len and not kwargs_len:
raise RuntimeError("No inputs provided.")
if args_len and kwargs_len:
raise RuntimeError("Cannot specify args and kwargs at the same time")
placeholders = self._create_input_placeholders_fn()
if args_len:
if args_len != len(placeholders):
raise RuntimeError(f"Expected {len(placeholders)} inputs, got {args_len}.")
for input, value in zip(placeholders, args):
input.set_data_from_numpy(value.cpu().numpy())
else:
for input in placeholders:
value = kwargs[input.name]
input.set_data_from_numpy(value.cpu().numpy())
return placeholders
View on GitHub (pinned to 20d1d78a08)
Solutions
- Pass at least one input: model(tensor) or model(images=tensor) matching the model's declared input names.
- If calling through a batching layer, skip the call when the batch is empty rather than invoking the model with zero tensors.
- Check that refactors forwarding *args, **kwargs preserve the tensors (e.g. a lost ** in model(**payload)).
Example fix
# before result = model() # RuntimeError: No inputs provided. # after result = model(images)
Defensive patterns
Strategy: validation
Validate before calling
if not args and not kwargs:
raise ValueError("Refusing to call Triton model with no inputs; check the upstream batch/request body.")
# only then:
result = triton_model(*args, **kwargs) Type guard
def has_inference_inputs(args: tuple, kwargs: dict) -> bool:
"""True when at least one positional or keyword input is present."""
return len(args) > 0 or len(kwargs) > 0 Try / catch
try:
outputs = triton_model(inputs)
except RuntimeError as e:
if "No inputs provided" in str(e):
LOGGER.warning("Empty inference request; returning empty result")
outputs = []
else:
raise Prevention
- Skip inference entirely for empty batches/requests instead of calling the model.
- Validate request payloads at the HTTP/service boundary before forwarding to the Triton client.
- Log payload shape/keys before dispatch to catch dropped arguments during refactors.
When it happens
Trigger: Calling the TritonClient instance with no arguments: model() instead of model(input_tensor) or model(images=tensor). Also reached indirectly when a serving loop forwards an empty batch to a Triton-backed DetectMultiBackend.
Common situations: Wrapping TritonClient in a generic inference service that forwards *args/**kwargs from an HTTP handler and receives an empty request body; batching code that calls the model once per batch even when the batch is empty; refactoring positional calls into kwargs and accidentally dropping the argument.
Related errors
- Expected {len(placeholders)} inputs, got {args_len}.
- Cannot specify args and kwargs at the same time
- Source path '{source}' does not exist
- TensorRT engine deserialization failed. Re-export the engine
- ERROR: YOLOv5 TF.js inference is not supported
AI-assisted analysis of ultralytics/yolov5@20d1d78a08 (2026-08-15).
Data as JSON: /api/errors/1f00268bccaca76c.
Report an issue: GitHub.