jax-ml/jax · error · ValueError

Expected assume_a to be one of {valid_assume_a}; got {assume

Error message

Expected assume_a to be one of {valid_assume_a}; got {assume_a!r}

What it means

jax.scipy.linalg.solve validates the assume_a argument, which tells it what matrix structure to exploit: 'gen' (general), 'sym' (symmetric), 'her' (hermitian), or 'pos' (positive definite). Any other string — including the older JAX spelling 'posdef' that newer JAX versions dropped — raises ValueError.

Source

Thrown at jax/_src/scipy/linalg.py:1266

    A simple 3x3 linear system:

    >>> A = jnp.array([[1., 2., 3.],
    ...                [2., 4., 2.],
    ...                [3., 2., 1.]])
    >>> b = jnp.array([14., 16., 10.])
    >>> x = jax.scipy.linalg.solve(A, b)
    >>> x
    Array([1., 2., 3.], dtype=float32)

    Confirming that the result solves the system:

    >>> jnp.allclose(A @ x, b)
    Array(True, dtype=bool)
  """
  del overwrite_a, overwrite_b, debug, check_finite  #unused
  valid_assume_a = ['gen', 'sym', 'her', 'pos']
  if assume_a not in valid_assume_a:
    raise ValueError(f"Expected assume_a to be one of {valid_assume_a}; got {assume_a!r}")
  return _solve(a, b, assume_a, lower)

@jit(static_argnames=('trans', 'lower', 'unit_diagonal'))
def _solve_triangular(a: ArrayLike, b: ArrayLike, trans: int | str,
                      lower: bool, unit_diagonal: bool) -> Array:
  if trans == 0 or trans == "N":
    transpose_a, conjugate_a = False, False
  elif trans == 1 or trans == "T":
    transpose_a, conjugate_a = True, False
  elif trans == 2 or trans == "C":
    transpose_a, conjugate_a = True, True
  else:
    raise ValueError(f"Invalid 'trans' value {trans}")

  a, b = promote_dtypes_inexact(jnp.asarray(a), jnp.asarray(b))

  if b.ndim == 1:
    signature = "(n,n),(n)->(n)"

View on GitHub (pinned to 1e1c6a8fc0)

Solutions

  1. Replace assume_a='posdef' with assume_a='pos'
  2. Use only 'gen', 'sym', 'her', or 'pos'
  3. Pin or grep your codebase for 'posdef' when upgrading JAX versions

Example fix

// before
x = jax.scipy.linalg.solve(a, b, assume_a='posdef')
// after
x = jax.scipy.linalg.solve(a, b, assume_a='pos')
Defensive patterns

Strategy: validation

Validate before calling

_VALID = {'gen','sym','her','pos'}
assume_a = {'posdef': 'pos'}.get(assume_a, assume_a)
assert assume_a in _VALID

Type guard

null

Prevention

When it happens

Trigger: Calling jax.scipy.linalg.solve(a, b, assume_a='posdef') or assume_a='cholesky' (both accepted by some other libraries) or a typo.

Common situations: Code written against older JAX or other frameworks where 'posdef' was valid; JAX renamed it to 'pos', breaking version upgrades.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of jax-ml/jax@1e1c6a8fc0 (2026-08-27). Data as JSON: /api/errors/335b25927131b8aa. Report an issue: GitHub.