jax-ml/jax · error · ValueError
More than one location found in string: {location_string}
Error message
More than one location found in string: {location_string} What it means
When Mosaic parses a location string from an XLA runtime error, it expects exactly one location pattern match (an equation plus its Python frames). Finding more than one means the error string contains multiple embedded locations and is ambiguous, so parsing aborts.
Source
Thrown at jax/_src/pallas/mosaic/error_handling.py:143
`loc("location_name"(<callsite>))`
Where <callsite> is a nested callsite string representing the entire
call stack:
`callsite("fn_name"("filename":lineno:colno) at callsite(...))`
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
View on GitHub (pinned to 1e1c6a8fc0)
Solutions
- Update JAX/Mosaic — parser robustness for multi-location strings improves over versions
- Reproduce with a single failing op to get a clean single-location error
- If you construct location strings (tests), pass one location per call
Defensive patterns
Strategy: try-catch
Try / catch
try:
loc = parse_location_string(err_str)
except ValueError:
loc = None # fall back to raw string reporting Prevention
- Treat location parsing as best-effort; always keep the raw XLA message
- Update JAX/Mosaic together to keep parser and error format in sync
When it happens
Trigger: An XLA runtime error message containing two LOCATION_PATTERN matches — e.g., an error raised inside nested/serialized tracebacks or a message that embeds another error's location — being processed by _handle_xla_runtime_error/_traceback_from_location.
Common situations: Chained/rethrown XLA errors during TPU kernel execution; Mosaic version changes that alter error string formats; tests feeding concatenated location strings.
Related errors
- Could not find location in string {location_string}
- Compiler params for platform {platform} cannot be used for {
- Memory space {self.memory_space} is not supported by mesh {s
- Acc ref must be at least 2D, got shape {shape}
- Acc ref dtype must be float32 or int32, got {dtype}
AI-assisted analysis of jax-ml/jax@1e1c6a8fc0 (2026-08-27).
Data as JSON: /api/errors/55bd0a17771c5213.
Report an issue: GitHub.