{"record":{"id":"daa0e3bc33225325","repo":"jax-ml/jax","slug":"unknown-boundary-option-boundary-must-be-one","errorCode":null,"errorMessage":"Unknown boundary option '{boundary}', must be one of: {list(boundary_funcs.keys())}","messagePattern":"Unknown boundary option '(.+?)', must be one of: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/scipy/signal.py","lineNumber":650,"sourceCode":"\n  def make_pad(mode, **kwargs):\n    def pad(x, n, axis=-1):\n      pad_width = [(0, 0) for unused_n in range(x.ndim)]\n      pad_width[axis] = (n, n)\n      return jnp.pad(x, pad_width, mode, **kwargs)\n    return pad\n\n  boundary_funcs = {\n      'even': make_pad('reflect'),\n      'odd': odd_ext,\n      'constant': make_pad('edge'),\n      'zeros': make_pad('constant', constant_values=0.0),\n      None: lambda x, *args, **kwargs: x\n  }\n\n  # Check/ normalize inputs\n  if boundary not in boundary_funcs:\n    raise ValueError(\n        f\"Unknown boundary option '{boundary}', \"\n        f\"must be one of: {list(boundary_funcs.keys())}\")\n\n  axis = core.concrete_or_error(operator.index, axis, \"axis of windowed-FFT\")\n  axis = canonicalize_axis(axis, x.ndim)\n\n  if y is None:\n    check_arraylike('spectral_helper', x)\n    x, = promote_dtypes_inexact(x)\n    y_arr = x  # place-holder for type checking\n    outershape = tuple_delete(x.shape, axis)\n  else:\n    if mode != 'psd':\n      raise ValueError(\"two-argument mode is available only when mode=='psd'\")\n    check_arraylike('spectral_helper', x, y)\n    x, y_arr = promote_dtypes_inexact(x, y)\n    if x.ndim != y_arr.ndim:\n      raise ValueError(\"two-arguments must have the same rank ({x.ndim} vs {y.ndim}).\")","sourceCodeStart":632,"sourceCodeEnd":668,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/scipy/signal.py#L632-L668","documentation":"The boundary argument of the spectral functions selects how each segment is extended before windowing; JAX implements only 'even', 'odd', 'zeros', and None (None skips extension). Any other string is rejected with the list of valid keys.","triggerScenarios":"jax.scipy.signal.stft(x, boundary='reflect') or 'constant' (scipy pad-style names); boundary='' from an unset config.","commonSituations":"Confusing jnp.pad mode names ('wrap', 'symmetric') with the boundary vocabulary; porting code from other STFT implementations.","solutions":["Use one of 'even', 'odd', 'zeros', or None","Pass boundary=None and pre-pad manually if you need other extension semantics"],"exampleFix":"// before\njax.scipy.signal.stft(x, boundary='symmetric')\n// after\njax.scipy.signal.stft(x, boundary='even')\n# or pre-pad: jax.scipy.signal.stft(jnp.pad(x,(k,k)), boundary=None)","handlingStrategy":"validation","validationCode":"BOUNDARIES = ('even', 'odd', 'zeros', None)\nassert boundary in BOUNDARIES, f'boundary must be one of {BOUNDARIES}'","typeGuard":"def is_valid_boundary(b) -> bool:\n    return b in ('even', 'odd', 'zeros', None)","tryCatchPattern":null,"preventionTips":["Remember boundary vocabulary differs from jnp.pad mode names","Pre-pad manually and use boundary=None for custom extension"],"tags":["jax","scipy","stft","boundary","invalid-argument-value"],"backgroundTag":"invalid-enum-argument","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}