{"record":{"id":"55bd0a17771c5213","repo":"jax-ml/jax","slug":"more-than-one-location-found-in-string-location","errorCode":null,"errorMessage":"More than one location found in string: {location_string}","messagePattern":"More than one location found in string: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/mosaic/error_handling.py","lineNumber":143,"sourceCode":"  `loc(\"location_name\"(<callsite>))`\n\n  Where <callsite> is a nested callsite string representing the entire\n  call stack:\n  `callsite(\"fn_name\"(\"filename\":lineno:colno) at callsite(...))`\n\n  Args:\n    location_string: A string serialization of an MLIR location.\n\n  Returns:\n    A tuple (name, frames) where name is the name of the location and frames\n    is a list of RawFrame objects representing the Python call stack associated\n    with the location.\n  \"\"\"\n  frame_str = ''\n  loc_name = None\n  matches = list(re.finditer(LOCATION_PATTERN, location_string))\n  if len(matches) > 1:\n    raise ValueError(\n        'More than one location found in string: ', location_string)\n  for mat in matches:\n    loc_name = mat.group('eqn_str')[1:-1]\n    frame_str = mat.group('frames')[1:-1]\n  if loc_name is None:\n    raise ValueError(f'Could not find location in string {location_string}')\n  frames: list[RawFrame] = []\n  for mat in re.finditer(FRAME_PATTERN, frame_str):\n    frames.append(\n        RawFrame(\n            mat.group('fun_name')[1:-1],\n            mat.group('filename')[1:-1],\n            int(mat.group('lineno')),\n            int(mat.group('colno')),\n        )\n    )\n  return loc_name, frames\n","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/mosaic/error_handling.py#L125-L161","documentation":"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.","triggerScenarios":"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.","commonSituations":"Chained/rethrown XLA errors during TPU kernel execution; Mosaic version changes that alter error string formats; tests feeding concatenated location strings.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    loc = parse_location_string(err_str)\nexcept ValueError:\n    loc = None  # fall back to raw string reporting","preventionTips":["Treat location parsing as best-effort; always keep the raw XLA message","Update JAX/Mosaic together to keep parser and error format in sync"],"tags":["jax","pallas","tpu","error-handling","parsing"],"backgroundTag":"error-message-parse-failure","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}