{"record":{"id":"bcca06b064c5844c","repo":"jax-ml/jax","slug":"cannot-specify-both-out-shape-and-out-type-use-ou","errorCode":null,"errorMessage":"Cannot specify both out_shape and out_type. Use out_type.","messagePattern":"Cannot specify both out_shape and out_type\\. Use out_type\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/mosaic_gpu/core.py","lineNumber":340,"sourceCode":"        interpret=interpret,\n        debug=debug,\n        **mesh_kwargs,\n    )\n\n  if (\n      not isinstance(out_shape, api.NotSpecified)\n      or not isinstance(scratch_shapes, api.NotSpecified)\n  ):\n    deprecations.warn(\n        \"jax-pallas-mgpu-shapes-types\",\n        \"The out_shape and scratch_shapes arguments to plgpu.kernel are\"\n        \" deprecated. Use out_type and scratch_types instead.\",\n        stacklevel=2,\n    )\n\n  if not isinstance(out_shape, api.NotSpecified):\n    if not isinstance(out_type, api.NotSpecified):\n      raise ValueError(\n          \"Cannot specify both out_shape and out_type. Use out_type.\"\n      )\n    out_type = out_shape\n  elif isinstance(out_type, api.NotSpecified):\n    out_type = ()\n\n  if not isinstance(scratch_shapes, api.NotSpecified):\n    if not isinstance(scratch_types, api.NotSpecified):\n      raise ValueError(\n          \"Cannot specify both scratch_shapes and scratch_types. Use\"\n          \" scratch_types.\"\n      )\n    scratch_types = scratch_shapes\n  elif isinstance(scratch_types, api.NotSpecified):\n    scratch_types = ()\n\n  if unwrap_out := not isinstance(out_type, (tuple, list)):\n    out_type = (out_type,)","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/mosaic_gpu/core.py#L322-L358","documentation":"In `jax.experimental.pallas.mosaic_gpu.kernel`, `out_shape` is the deprecated name for what is now `out_type`. You may pass one or the other, not both; supplying both raises this ValueError telling you to use `out_type`.","triggerScenarios":"Calling `mosaic_gpu.kernel(f, out_shape=..., out_type=..., ...)` with both keyword arguments non-NotSpecified.","commonSituations":"Migrating older Pallas code to a newer JAX where `out_type` was introduced; automated codemods that added `out_type` without removing the legacy `out_shape`; merging code from two branches that each used a different spelling.","solutions":["Delete `out_shape=` and keep only `out_type=` (they are equivalent, out_type is the modern name)","If you must support old JAX versions, branch on `jax.__version__` or use try/except TypeError","Silence the deprecation path entirely by never passing out_shape"],"exampleFix":"# before\nkernel_fn = mgpu.kernel(pallas_fn, out_shape=(128, jnp.float32), out_type=(128, jnp.float32), grid=grid)\n# after\nkernel_fn = mgpu.kernel(pallas_fn, out_type=(128, jnp.float32), grid=grid)","handlingStrategy":"validation","validationCode":"import inspect\ndef make_kernel(fn, **kw):\n    params = inspect.signature(mgpu.kernel).parameters\n    if 'out_type' in kw and 'out_shape' in kw:\n        del kw['out_shape']  # prefer modern name\n    if 'out_type' not in params and 'out_type' in kw:\n        kw['out_shape'] = kw.pop('out_type')\n    return mgpu.kernel(fn, **kw)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize on out_type in all call sites; grep for out_shape after upgrades","Wrap kernel creation once in a project-level helper"],"tags":["jax","pallas","mosaic-gpu","deprecation","api-migration"],"backgroundTag":"deprecated-argument-conflict","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}