-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Is it platform specific
generic
Importance or Severity
Critical
Description of the bug
Summary
The dash-sai package build fails on the 202405 branch due to a breaking change in jsonpath-ng==1.8.0, causing sai_api_gen.py to crash with a TypeError.
Error
The build is failing with this error below:
File "dash-pipeline/SAI/./sai_api_gen.py", line 68, in from_ir ir_def_node["Source_Info"]["source_fragment"],
TypeError: list indices must be integers or slices, not st
make[2]: *** [Makefile:3: all] Error 1
make[1]: *** [Makefile:16: /sonic/target/debs/bookworm/libsai_1.0.0_amd64.deb] Error 2
Root Cause
sai_api_gen.py uses jsonpath-ng to walk the P4 IR JSON. In jsonpath-ng==1.8.0 (released ~Feb 27, 2026), the find() method changed behavior: nested dict values are now returned as lists instead of dicts, stripping their keys. This causes ir_def_node["Source_Info"] to be a list instead of a dict, breaking the string key access.
jsonpath-ng==1.7.0→{"source_fragment": "..."}✅jsonpath-ng==1.8.0→["..."]❌
The build environment installs jsonpath-ng from PyPI without a pinned version, so it picked up 1.8.0 automatically.
Affected Branch
202405 — pinned to DASH_SAI_COMMIT = cc281333e24ade258773ea843f669251a44d7c9a
Related Issues
- jsonpath-ng incorrectly parsing the P4IRTree.program JSON DASH#697: jsonpath-ng incorrectly parsing the P4IRTree.program JSON DASH#697
- jsonpath-ng upstream bug ([1.8.0] Keys stripped from nested dict matches in jsonpath_ext.find() h2non/jsonpath-ng#216): [1.8.0] Keys stripped from nested dict matches in jsonpath_ext.find() h2non/jsonpath-ng#216
Suggested Fix
Pin jsonpath-ng<1.8.0 in the DASH SAI build environment, or update DASH_SAI_COMMIT in rules/dash-sai.mk to a commit that constrains the jsonpath-ng version.
Note: master branch has already moved to DASH_SAI_COMMIT = 57e599c9d8e1f538ea01fad28781d8a0c2706ba5 which may include a workaround.
Steps to Reproduce
Build a 202405 sonic image
Actual Behavior and Expected Behavior
The build should succeed
Relevant log output
File "dash-pipeline/SAI/./sai_api_gen.py", line 68, in from_ir ir_def_node["Source_Info"]["source_fragment"],
TypeError: list indices must be integers or slices, not st
make[2]: *** [Makefile:3: all] Error 1
make[1]: *** [Makefile:16: /sonic/target/debs/bookworm/libsai_1.0.0_amd64.deb] Error 2Output of show version, show techsupport
Attach files (if any)
No response