jax-ml/jax · warning · ValueError

Could not find location in string {location_string}

Error message

Could not find location in string {location_string}

What it means

The location parser found zero matches for the expected location pattern in the error string, so it cannot recover the equation name and Python frames needed to build a user-facing traceback. This usually means the XLA error format doesn't match what the parser expects.

Source

Thrown at jax/_src/pallas/mosaic/error_handling.py:149

  Args:
    location_string: A string serialization of an MLIR location.

  Returns:
    A tuple (name, frames) where name is the name of the location and frames
    is a list of RawFrame objects representing the Python call stack associated
    with the location.
  """
  frame_str = ''
  loc_name = None
  matches = list(re.finditer(LOCATION_PATTERN, location_string))
  if len(matches) > 1:
    raise ValueError(
        'More than one location found in string: ', location_string)
  for mat in matches:
    loc_name = mat.group('eqn_str')[1:-1]
    frame_str = mat.group('frames')[1:-1]
  if loc_name is None:
    raise ValueError(f'Could not find location in string {location_string}')
  frames: list[RawFrame] = []
  for mat in re.finditer(FRAME_PATTERN, frame_str):
    frames.append(
        RawFrame(
            mat.group('fun_name')[1:-1],
            mat.group('filename')[1:-1],
            int(mat.group('lineno')),
            int(mat.group('colno')),
        )
    )
  return loc_name, frames


def traceback_from_raw_frames(frames: list[RawFrame]) -> types.TracebackType:
  """Constructs a traceback from a list of RawFrame objects."""
  xla_frames = [
    xla_client.Frame(frame.filename, frame.func_name, -1, frame.lineno)
    for frame in frames

View on GitHub (pinned to 1e1c6a8fc0)

Solutions

  1. Update JAX and libtpu/Mosaic together so error formats match
  2. Look at the raw XLA error text directly for diagnosis — the location metadata is simply missing
  3. Report the raw error string to JAX maintainers if it persists on matched versions
Defensive patterns

Strategy: try-catch

Try / catch

try:
    loc = parse_location_string(err_str)
except ValueError:
    log.warning('no location in XLA error: %s', err_str)
    loc = None

Prevention

When it happens

Trigger: An XLA runtime error whose message lacks the standard location annotation (e.g., an error emitted before tracing info attached, or from a different M/XLA version) reaching parse_location_string.

Common situations: Version mismatch between Mosaic and the XLA runtime producing differently-formatted errors; errors from uninstrumented code paths; out-of-memory or driver-level errors with no source location.

Related errors


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