{"record":{"id":"5b5133face47cd37","repo":"jax-ml/jax","slug":"array-got-multiple-values-for-argument-name","errorCode":null,"errorMessage":"array() got multiple values for argument '{name}'","messagePattern":"array\\(\\) got multiple values for argument '(.+?)'","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"jax/_src/numpy/array_constructors.py","lineNumber":188,"sourceCode":"    Array([0. , 0.5, 1. , 1.5, 2. ], dtype=float32)\n\n    Constructing a JAX array via the Python buffer interface, using Python's\n    built-in :mod:`array` module.\n\n    >>> from array import array\n    >>> pybuffer = array('i', [2, 3, 5, 7])\n    >>> jnp.array(pybuffer)\n    Array([2, 3, 5, 7], dtype=int32)\n\n  .. _explicit sharding: https://docs.jax.dev/en/latest/parallel.html\n  \"\"\"\n  if args:\n    if len(args) > 3:\n      raise TypeError(f\"array() takes at most 5 positional arguments but {len(args) + 2} were given\")\n\n    for i, name in enumerate([\"copy\", \"order\", \"ndmin\"]):\n      if i < len(args) and [copy, order, ndmin][i] != [True, \"K\", 0][i]:\n        raise TypeError(f\"array() got multiple values for argument '{name}'\")\n    copy, order, ndmin = (list(args) + [copy, order, ndmin][len(args):])[:3]\n\n    deprecations.warn(\n        \"jax-array-positional-args\",\n        \"Passing the copy, order, and ndmin arguments to jnp.array positionally \"\n        \"is deprecated. Use keyword arguments instead.\",\n        stacklevel=2)\n\n  if order is not None and order != \"K\":\n    raise NotImplementedError(\"Only implemented for order='K'\")\n\n  # Fast path: if we're not actually doing any conversion, in many cases we\n  # can call lax.stage to lift the value into the trace.\n  if dtype is None and device is None and out_sharding is None and ndmin == 0:\n    if isinstance(object, core.Tracer) and not core.is_concrete(object):\n      return lax._array_copy(object) if copy else object\n    if isinstance(object, (int, float, complex, np.number)):\n      return lax.stage(object)","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/numpy/array_constructors.py#L170-L206","documentation":"When copy/order/ndmin are supplied positionally as *args, jnp.array checks whether the same option was ALSO given as a keyword. If both positional and keyword values are present, it raises this 'multiple values' TypeError like a normal Python signature would.","triggerScenarios":"jnp.array(x, True, ndmin=1) — copy passed positionally and ndmin also as keyword — where the positional slot conflicts with a non-default keyword value.","commonSituations":"Migrating old NumPy-style positional calls while partially modernizing some arguments to keywords; positional use is deprecated anyway.","solutions":["Use keyword arguments exclusively for copy, order, ndmin","Audit call sites mixing positional and keyword forms of these three options"],"exampleFix":"# before\na = jnp.array(x, True, ndmin=1)\n# after\na = jnp.array(x, copy=True, ndmin=1)","handlingStrategy":"validation","validationCode":"# ensure copy/order/ndmin passed only once, as keywords\nassert not positional_copy_order_ndmin, 'use keywords'","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Keywords-only style for these three options","Run a deprecation lint for jax-array-positional-args"],"tags":["jax","argument-validation","numpy-compat","deprecation"],"backgroundTag":"duplicate-argument","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}