{"record":{"id":"f74e8219f7563567","repo":"bazelbuild/bazel","slug":"path-fragment-id-not-found","errorCode":null,"errorMessage":"Path Fragment id not found.","messagePattern":"Path Fragment id not found\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/aquery_differ/resolvers/path_fragment_resolver.py","lineNumber":39,"sourceCode":"  def __init__(self, path_fragments):\n    self._id_to_path_fragment = {\n        path_fragment.id: path_fragment for path_fragment in path_fragments\n    }\n\n  def resolve(self, path_fragment_id):\n    \"\"\"Given a path_fragment_id, return the full path.\n\n    Args:\n      path_fragment_id: an int id of the path fragment.\n\n    Returns:\n      The string representing the full exec path.\n    \"\"\"\n    exec_path_tokens = []\n    curr_id = path_fragment_id\n    while curr_id:\n      if curr_id not in self._id_to_path_fragment:\n        raise ValueError('Path Fragment id not found.')\n\n      entry = self._id_to_path_fragment[curr_id]\n      exec_path_tokens.append(entry.label)\n      curr_id = entry.parent_id\n\n    return os.path.join(*reversed(exec_path_tokens))\n","sourceCodeStart":21,"sourceCodeEnd":46,"githubUrl":"https://github.com/bazelbuild/bazel/blob/e6e199d0601a244511b4cf18c8b2828aa73db1fd/tools/aquery_differ/resolvers/path_fragment_resolver.py#L21-L46","documentation":"Thrown by aquery_differ's path_fragment_resolver when walking the parent chain of a path fragment id. Kythe/aquery exec paths are stored as linked fragments; the resolver climbs from the given id through parent_id entries. If any id in the chain is absent from the _id_to_path_fragment table, it raises ValueError('Path Fragment id not found.').","triggerScenarios":"Consuming aquery output where an output/file id references path_fragments that were not included in the converted table — e.g. two aquery invocations with different scopes/flags so one side lacks fragments the other side references, or filtering that dropped path_fragment rows.","commonSituations":"Diffing aquery results between bazel versions or between queries with different --output options; textproto conversion that skipped some path_fragment entries; truncated aquery output from an interrupted command.","solutions":["Re-run both aquery invocations with identical flags (same --output=textproto/--skyframe scope) so their path_fragment sets are consistent.","Ensure the converter feeding _id_to_path_fragment ingests ALL path_fragments from the aquery output, not a filtered subset.","Regenerate the aquery artifacts if the bazel invocation may have been interrupted or the server restarted mid-query."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"def all_fragments_present(path_fragment_ids, id_to_fragment):\n    for pid in path_fragment_ids:\n        while pid:\n            if pid not in id_to_fragment:\n                return False\n            pid = id_to_fragment[pid].parent_id\n    return True","typeGuard":null,"tryCatchPattern":"try:\n    path = resolver.resolve(path_fragment_id)\nexcept ValueError as e:\n    # 'Path Fragment id not found.' — regenerate aquery artifacts and retry once\n    raise","preventionTips":["Always produce the two aquery dumps you diff with identical flags and scopes.","Never filter path_fragment rows out of aquery textproto output."],"tags":["aquery","bazel","analysis","path-fragments"],"backgroundTag":null,"analyzedSha":"e6e199d0601a244511b4cf18c8b2828aa73db1fd","analyzedAt":"2026-08-14T10:24:27.848Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}