{"record":{"id":"e98b972c0b48c645","repo":"jax-ml/jax","slug":"unknown-action-action","errorCode":null,"errorMessage":"Unknown action: {action}","messagePattern":"Unknown action: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/mosaic/helpers.py","lineNumber":42,"sourceCode":"\ndef sync_copy(src_ref, dst_ref, *, add: bool = False) -> None:\n  \"\"\"Synchronously copies a PyTree of refs to another PyTree of refs.\"\"\"\n  if not jax.tree.leaves(src_ref):\n    # No buffers to copy so skip the function.\n    return\n\n  @functools.partial(\n      pl_primitives.run_scoped, sem=tpu_core.SemaphoreType.DMA(())\n  )\n  def _(sem):\n    def _copy_start_or_wait(action, src_ref, dst_ref):\n      descriptor = plm_primitives.make_async_copy(src_ref, dst_ref, sem)\n      if action == \"start\":\n        descriptor.start(add=add)\n      elif action == \"wait\":\n        descriptor.wait()\n      else:\n        raise ValueError(f\"Unknown action: {action}\")\n\n    jax.tree.map(\n        functools.partial(_copy_start_or_wait, \"start\"),\n        src_ref,\n        dst_ref,\n    )\n    jax.tree.map(\n        functools.partial(_copy_start_or_wait, \"wait\"),\n        src_ref,\n        dst_ref,\n    )\n\n\ndef run_on_first_core(core_axis_name: str):\n  \"\"\"Runs a function on the first core in a given axis.\"\"\"\n  num_cores = jax.lax.axis_size(core_axis_name)\n  if num_cores == 1:\n    return lambda f: f()","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/mosaic/helpers.py#L24-L60","documentation":"The helper _copy_start_or_wait dispatches on an action string that must be exactly 'start' or 'wait' for async copy descriptors. Any other string (typo, wrong case, new action like 'commit') raises ValueError.","triggerScenarios":"Calling the async copy helper (used by Mosaic/TensorCore copy plumbing) with an action argument other than 'start'/'wait' — typically only reachable from internal code or monkey-patched wrappers passing a custom action.","commonSituations":"Extending JAX internals with new async-copy actions; typos in patched versions; calling private helpers directly from user code.","solutions":["Use exactly 'start' or 'wait' as the action string","If you need a new action, implement it in the descriptor API rather than the dispatch string","Avoid relying on this private helper; use pltpu async_copy primitives instead"],"exampleFix":"// before\n_copy_start_or_wait(src, dst, action='Start')  # wrong case\n// after\n_copy_start_or_wait(src, dst, action='start')","handlingStrategy":"validation","validationCode":"assert action in ('start', 'wait'), action","typeGuard":"def is_copy_action(a: str) -> TypeGuard[Literal['start','wait']]: return a in ('start','wait')","tryCatchPattern":null,"preventionTips":["Don't call private helpers; use pltpu async_copy primitives","Constants for action strings instead of literals"],"tags":["jax","pallas","tpu","async-copy","internal-api"],"backgroundTag":"invalid-argument-value","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}