{"record":{"id":"1f00268bccaca76c","repo":"ultralytics/yolov5","slug":"no-inputs-provided","errorCode":null,"errorMessage":"No inputs provided.","messagePattern":"No inputs provided\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"utils/triton.py","lineNumber":64,"sourceCode":"    def __call__(self, *args, **kwargs) -> torch.Tensor | tuple[torch.Tensor, ...]:\n        \"\"\"Invokes the model.\n\n        Parameters can be provided via args or kwargs. args, if provided, are assumed to match the order of inputs of\n        the model. kwargs are matched with the model input names.\n        \"\"\"\n        inputs = self._create_inputs(*args, **kwargs)\n        response = self.client.infer(model_name=self.model_name, inputs=inputs)\n        result = []\n        for output in self.metadata[\"outputs\"]:\n            tensor = torch.as_tensor(response.as_numpy(output[\"name\"]))\n            result.append(tensor)\n        return result[0] if len(result) == 1 else result\n\n    def _create_inputs(self, *args, **kwargs):\n        \"\"\"Creates input tensors from args or kwargs, not both; raises error if none or both are provided.\"\"\"\n        args_len, kwargs_len = len(args), len(kwargs)\n        if not args_len and not kwargs_len:\n            raise RuntimeError(\"No inputs provided.\")\n        if args_len and kwargs_len:\n            raise RuntimeError(\"Cannot specify args and kwargs at the same time\")\n\n        placeholders = self._create_input_placeholders_fn()\n        if args_len:\n            if args_len != len(placeholders):\n                raise RuntimeError(f\"Expected {len(placeholders)} inputs, got {args_len}.\")\n            for input, value in zip(placeholders, args):\n                input.set_data_from_numpy(value.cpu().numpy())\n        else:\n            for input in placeholders:\n                value = kwargs[input.name]\n                input.set_data_from_numpy(value.cpu().numpy())\n        return placeholders\n","sourceCodeStart":46,"sourceCodeEnd":79,"githubUrl":"https://github.com/ultralytics/yolov5/blob/20d1d78a08277e365d57bfa3a2cce752772d9e59/utils/triton.py#L46-L79","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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))."],"exampleFix":"# before\nresult = model()  # RuntimeError: No inputs provided.\n# after\nresult = model(images)","handlingStrategy":"validation","validationCode":"if not args and not kwargs:\n    raise ValueError(\"Refusing to call Triton model with no inputs; check the upstream batch/request body.\")\n# only then:\nresult = triton_model(*args, **kwargs)","typeGuard":"def has_inference_inputs(args: tuple, kwargs: dict) -> bool:\n    \"\"\"True when at least one positional or keyword input is present.\"\"\"\n    return len(args) > 0 or len(kwargs) > 0","tryCatchPattern":"try:\n    outputs = triton_model(inputs)\nexcept RuntimeError as e:\n    if \"No inputs provided\" in str(e):\n        LOGGER.warning(\"Empty inference request; returning empty result\")\n        outputs = []\n    else:\n        raise","preventionTips":["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."],"tags":["triton","inference","client","input-validation"],"backgroundTag":null,"analyzedSha":"20d1d78a08277e365d57bfa3a2cce752772d9e59","analyzedAt":"2026-08-15T02:56:15.443Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}