{"record":{"id":"1a05bf302d4a7c39","repo":"jax-ml/jax","slug":"unsupported-mode-mode","errorCode":null,"errorMessage":"Unsupported mode: {mode}","messagePattern":"Unsupported mode: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/nn/functions.py","lineNumber":1426,"sourceCode":"        return BlockScaleConfig(\n            mode='nvfp4',\n            block_size=16,\n            data_type=dtypes.float4_e2m1fn,\n            scale_type=dtypes.float8_e4m3fn,\n            global_scale=one if global_scale is None else global_scale,\n            infer_only=False\n        )\n    elif mode == 'mxfp8':\n        return BlockScaleConfig(\n            mode='mxfp8',\n            block_size=32,\n            data_type=dtypes.float8_e4m3fn,\n            scale_type=dtypes.float8_e8m0fnu,\n            global_scale=None,\n            infer_only=False\n        )\n    else:\n        raise ValueError(f\"Unsupported mode: {mode}\")\n\ndef scaled_dot_general(\n    lhs, rhs,\n    dimension_numbers,\n    preferred_element_type=np.float32,\n    configs: list[BlockScaleConfig] | None = None,\n    implementation: Literal['cudnn'] | None = None,\n  ):\n  r\"\"\"Scaled dot general operation.\n\n  Performs a generalized dot product with block-scaled quantization on the\n  lhs and rhs inputs. This operation extends `lax.dot_general` to support\n  user-defined scaling configurations.\n\n  Essentially, the operation follows::\n\n      a, a_scales = quantize(lhs, configs[0])\n      b, b_scales = quantize(rhs, configs[1])","sourceCodeStart":1408,"sourceCodeEnd":1444,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/nn/functions.py#L1408-L1444","documentation":"jax.nn.get_scaled_dot_general_config builds a BlockScaleConfig from a `mode` string (e.g. 'e4m3-with-e8m0-scales' style modes supported in this version). An unrecognized mode string raises this ValueError.","triggerScenarios":"Passing mode='mxfp4', mode=None, or a typo like 'e5m2-e8m0' to get_scaled_dot_general_config; using a mode string from a different JAX version.","commonSituations":"Experimenting with MX formats; copy-pasting config code between JAX versions where mode names changed; upgrading JAX and hitting renamed modes.","solutions":["Inspect the function's docstring/source for the accepted mode literals in your JAX version and use one","If the format you want is unsupported, construct a BlockScaleConfig manually instead of via mode","Upgrade JAX if the mode exists only in a newer release"],"exampleFix":"// before\ncfg = jax.nn.get_scaled_dot_general_config(mode='e5m2-e8m0')\n\n// after\ncfg = jax.nn.get_scaled_dot_general_config(mode='e4m3-e8m0')  # per docstring","handlingStrategy":"validation","validationCode":"# inspect supported modes from the docstring; e.g.\nSUPPORTED_MODES = {'e4m3-e8m0'}  # adjust to your JAX version\nif mode not in SUPPORTED_MODES: raise ValueError(f'unsupported mode {mode}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin the JAX version when using experimental float8 APIs","Read the mode literal list from the docstring at integration time"],"tags":["jax","nn","float8","config","enum-argument"],"backgroundTag":"invalid-enum-argument","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}