{"record":{"id":"26cbd49bf1a69a63","repo":"jax-ml/jax","slug":"no-input-was-provided-to-the-clip-function","errorCode":null,"errorMessage":"No input was provided to the clip function.","messagePattern":"No input was provided to the clip function\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/numpy/lax_numpy.py","lineNumber":3417,"sourceCode":"      result will not be clipped to any maximum value. If specified, it should be\n      broadcast-compatible with ``arr`` and ``min``.\n\n  Returns:\n    An array containing values from ``arr``, with values smaller than ``min`` set\n    to ``min``, and values larger than ``max`` set to ``max``.\n    Wherever ``min`` is larger than ``max``, the value of ``max`` is returned.\n\n  See also:\n    - :func:`jax.numpy.minimum`: Compute the element-wise minimum value of two arrays.\n    - :func:`jax.numpy.maximum`: Compute the element-wise maximum value of two arrays.\n\n  Examples:\n    >>> arr = jnp.array([0, 1, 2, 3, 4, 5, 6, 7])\n    >>> jnp.clip(arr, 2, 5)\n    Array([2, 2, 2, 3, 4, 5, 5, 5], dtype=int32)\n  \"\"\"\n  if arr is None:\n    raise ValueError(\"No input was provided to the clip function.\")\n\n  util.check_arraylike(\"clip\", arr)\n  if any(iscomplexobj(t) for t in (arr, min, max)):\n    raise ValueError(\n      \"Clip received a complex value either through the input or the min/max \"\n      \"keywords. Complex values have no ordering and cannot be clipped. \"\n      \"Please convert to a real value or array by taking the real or \"\n      \"imaginary components via jax.numpy.real/imag respectively.\")\n  if min is not None:\n    arr = ufuncs.maximum(min, arr)\n  if max is not None:\n    arr = ufuncs.minimum(max, arr)\n  return asarray(arr)\n\n\n@export\n@api.jit(static_argnames=('decimals',))\ndef round(a: ArrayLike, decimals: int = 0, out: None = None) -> Array:","sourceCodeStart":3399,"sourceCodeEnd":3435,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/numpy/lax_numpy.py#L3399-L3435","documentation":"jnp.clip's first positional argument is the array to clip; if it is None (e.g. only min/max were supplied via keywords), the call is invalid. This often happens when using newer min/max keyword names with positional-style calls.","triggerScenarios":"Calling jnp.clip(a=None, min=0) — e.g. jnp.clip(None, 0, 1), or code ported from APIs where the array was optional.","commonSituations":"Refactorings where the array variable is conditionally None; calling clip(min=..., max=...) and forgetting a=; defaults from a config dict yielding None.","solutions":["Always pass the array: jnp.clip(arr, 0, 1)","Check for None upstream if arr may be conditionally absent","Use explicit keywords to avoid positional mix-ups: jnp.clip(a=arr, min=0, max=1)"],"exampleFix":"// before\njnp.clip(None, min=0, max=1)\n// after\njnp.clip(arr, min=0, max=1)","handlingStrategy":"validation","validationCode":"assert arr is not None, 'clip requires an input array'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use keyword args (a=, min=, max=) in clip calls","Reject None early in wrapper functions"],"tags":["jax","clip","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}