{"record":{"id":"d488282446f81759","repo":"jax-ml/jax","slug":"unexpected-value-for-order-argument-order","errorCode":null,"errorMessage":"Unexpected value for 'order' argument: {order}.","messagePattern":"Unexpected value for 'order' argument: (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/numpy/array_methods.py","lineNumber":388,"sourceCode":"  \"\"\"Returns an array containing the same data with a new shape.\n\n  Refer to :func:`jax.numpy.reshape` for full documentation.\n  \"\"\"\n  __tracebackhide__ = True\n  newshape = _compute_newshape(self, args[0] if len(args) == 1 else args)\n  if order == \"C\":\n    return lax.reshape(self, newshape, None, out_sharding=out_sharding)\n  elif order == \"F\":\n    dims = list(range(self.ndim)[::-1])\n    out_sharding = canonicalize_sharding(out_sharding, \"jnp.reshape\")\n    out_sharding = (\n        None if out_sharding is None else out_sharding.update(\n            spec=out_sharding.spec.update(partitions=out_sharding.spec[::-1])))\n    return lax.reshape(self, newshape[::-1], dims, out_sharding=out_sharding).T\n  elif order == \"A\":\n    raise NotImplementedError(\"np.reshape order=A is not implemented.\")\n  else:\n    raise ValueError(f\"Unexpected value for 'order' argument: {order}.\")\n\ndef _round(self: Array, decimals: int = 0, out: None = None) -> Array:\n  \"\"\"Round array elements to a given decimal.\n\n  Refer to :func:`jax.numpy.round` for full documentation.\n  \"\"\"\n  return lax_numpy.round(self, decimals=decimals, out=out)\n\ndef _searchsorted(self: Array, v: ArrayLike, side: str = 'left',\n                  sorter: ArrayLike | None = None, *, method: str = 'scan') -> Array:\n  \"\"\"Perform a binary search within a sorted array.\n\n  Refer to :func:`jax.numpy.searchsorted` for full documentation.\"\"\"\n  return lax_numpy.searchsorted(self, v, side=side, sorter=sorter, method=method)\n\ndef _sort(self: Array, axis: int | None = -1, *, kind: None = None,\n          order: None = None, stable: bool = True, descending: bool = False) -> Array:\n  \"\"\"Return a sorted copy of an array.","sourceCodeStart":370,"sourceCodeEnd":406,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/numpy/array_methods.py#L370-L406","documentation":"Array.reshape validates the `order` argument and only accepts 'C', 'F' (and 'A' which raises NotImplementedError). Any other string raises ValueError immediately with the offending value. This catches typos like 'c', 'fortran', or 'rows'.","triggerScenarios":"Calling `arr.reshape(..., order=...)` with any value other than 'C', 'F', or 'A', e.g. order='c' (lowercase) or order='row-major'.","commonSituations":"Case typos; passing user-provided or config-driven order strings straight through to reshape.","solutions":["Use exactly 'C' or 'F' (uppercase)","Normalize/validate the order string before passing it","Check for stray whitespace or unicode quotes in config-supplied values"],"exampleFix":"# before\na.reshape(2, 3, order='c')\n\n# after\na.reshape(2, 3, order='C')","handlingStrategy":"validation","validationCode":"def check_order(order):\n    if order not in ('C', 'F'):\n        raise ValueError(f\"order must be 'C' or 'F', got {order!r}\")\n    return order","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate config-supplied order strings against a whitelist","Uppercase and strip order strings before passing"],"tags":["jax","reshape","invalid-argument","validation"],"backgroundTag":"invalid-enum-argument","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}