Skip to content

Improve material script error reporting with file and line context#1657

Open
arjo129 wants to merge 2 commits into
mainfrom
arjoc/feat/material_err
Open

Improve material script error reporting with file and line context#1657
arjo129 wants to merge 2 commits into
mainfrom
arjoc/feat/material_err

Conversation

@arjo129

@arjo129 arjo129 commented May 11, 2026

Copy link
Copy Markdown
Contributor

🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸

🎉 New feature

Closes #

Summary

This PR improves error reporting in materials to include files and line numbers. Ran into the need for this when debugging a sim world.

Test it

See this: #1657 (comment)

Checklist

  • Signed all commits for DCO
  • Added a screen capture or video to the PR description that demonstrates the feature
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • Updated Bazel files (if adding new files). Created an issue otherwise.
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers
  • Was GenAI used to generate this PR? If so, make sure to add "Generated-by" to your commits. (See this policy for more info.)

Generated-by: Gemini CLI

Generated-by: Gemini CLI
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@scpeters

Copy link
Copy Markdown
Member

I see an existing InvalidColors test in test/integration/material.cc, but I already see line numbers printed in the output of that test on main:

18:12:03 189: [ RUN      ] Material.InvalidColors
18:12:03 189: Error [Param.cc:1288] Error Code 34: Msg: The value <ambient>1.5 0 0 1</ambient> is invalid.
18:12:03 189: Error Code 9: [/sdf/model[@name="model"]/link[@name="link"]/visual[@name="material"]/material/ambient:/Users/jenkins/jenkins-agent/workspace/sdformat-ci-main-homebrew-arm64/sdformat/test/sdf/material_invalid.sdf:L7]: Msg: Error reading element <ambient>
18:12:03 189: Error Code 9: [/sdf/model[@name="model"]/link[@name="link"]/visual[@name="material"]/material:/Users/jenkins/jenkins-agent/workspace/sdformat-ci-main-homebrew-arm64/sdformat/test/sdf/material_invalid.sdf:L6]: Msg: Error reading element <material>
18:12:03 189: Error Code 9: [/sdf/model[@name="model"]/link[@name="link"]/visual[@name="material"]:/Users/jenkins/jenkins-agent/workspace/sdformat-ci-main-homebrew-arm64/sdformat/test/sdf/material_invalid.sdf:L5]: Msg: Error reading element <visual>
18:12:03 189: Error Code 9: [/sdf/model[@name="model"]/link[@name="link"]:/Users/jenkins/jenkins-agent/workspace/sdformat-ci-main-homebrew-arm64/sdformat/test/sdf/material_invalid.sdf:L4]: Msg: Error reading element <link>
18:12:03 189: Error Code 9: [/sdf/model[@name="model"]:/Users/jenkins/jenkins-agent/workspace/sdformat-ci-main-homebrew-arm64/sdformat/test/sdf/material_invalid.sdf:L3]: Msg: Error reading element <model>
18:12:03 189: Error Code 9: Msg: Error reading element <sdf>
18:12:03 189: Error Code 1: Msg: Unable to read file: [/Users/jenkins/jenkins-agent/workspace/sdformat-ci-main-homebrew-arm64/sdformat/test/sdf/material_invalid.sdf]

I may be misreading the console output, but can you give an example for where this code change is needed? If it's worth the effort, we could add it to the existing test

@arjo129

arjo129 commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

Try this world: https://gist.github.com/arjo129/52fb04da8df9c0a633c2e18e20f1e894

I was loading an old subt world to test something of my own and ran into the world not loading. Without this change the models that are problematic are not reported.

With this change:

[ServerPrivate.cc:794] Error Code 14: [:/Users/arjoc/.gz/fuel/fuel.ignitionrobotics.org/openrobotics/models/4-way finals transition 2/8/model.sdf:L24]: Msg: Parser configurations requested resolved uris, but uri [materials/scripts/] could not be resolved.
(2026-05-12 10:48:30.772) [error] [ServerPrivate.cc:794] Error Code 14: [:/Users/arjoc/.gz/fuel/fuel.ignitionrobotics.org/openrobotics/models/4-way finals transition 2/8/model.sdf:L52]: Msg: Parser configurations requested resolved uris, but uri [materials/scripts/] could not be resolved.
(2026-05-12 10:48:30.772) [error] [ServerPrivate.cc:794] Error Code 14: [:/Users/arjoc/.gz/fuel/fuel.ignitionrobotics.org/openrobotics/models/4-way finals transition 2/8/model.sdf:L80]: Msg: Parser configurations requested resolved uris, but uri [materials/scripts/] could not be resolved.
(2026-05-12 10:48:30.772) [error] [ServerPrivate.cc:794] Error Code 14: [:/Users/arjoc/.gz/fuel/fuel.gazebosim.org/openrobotics/models/urban tunnel transition straight/5/model.sdf:L25]: Msg: Parser configurations requested resolved uris, but uri [materials/scripts/] could not be resolved.
(2026-05-12 10:48:30.772) [error] [ServerPrivate.cc:794] Error Code 14: [:/Users/arjoc/.gz/fuel/fuel.gazebosim.org/openrobotics/models/urban tunnel transition straight/5/model.sdf:L53]: Msg: Parser configurations requested resolved uris, but uri [materials/scripts/] could not be resolved.
(2026-05-12 10:48:30.772) [error] [ServerPrivate.cc:794] Error Code 14: [:/Users/arjoc/.gz/fuel/fuel.gazebosim.org/openrobotics/models/urban tunnel transition straight/5/model.sdf:L81]: Msg: Parser configurations requested resolved uris, but uri [materials/scripts/] could not be resolved.
(2026-05-12 10:48:30.772) [error] [ServerPrivate.cc:794] Error Code 9: Msg: Failed to load a world.
(2026-05-12 10:48:30.772) [error] [ServerPrivate.cc:818] Unable to find world with name[final_prelim_02]. Downloaded models may not appear.

Without:

(2026-05-12 10:56:13.540) [error] [ServerPrivate.cc:794] Error Code 14: Msg: Parser configurations requested resolved uris, but uri [materials/scripts/] could not be resolved.
(2026-05-12 10:56:13.540) [error] [ServerPrivate.cc:794] Error Code 14: Msg: Parser configurations requested resolved uris, but uri [materials/scripts/] could not be resolved.
(2026-05-12 10:56:13.540) [error] [ServerPrivate.cc:794] Error Code 14: Msg: Parser configurations requested resolved uris, but uri [materials/scripts/] could not be resolved.
(2026-05-12 10:56:13.540) [error] [ServerPrivate.cc:794] Error Code 14: Msg: Parser configurations requested resolved uris, but uri [materials/scripts/] could not be resolved.
(2026-05-12 10:56:13.540) [error] [ServerPrivate.cc:794] Error Code 14: Msg: Parser configurations requested resolved uris, but uri [materials/scripts/] could not be resolved.
(2026-05-12 10:56:13.540) [error] [ServerPrivate.cc:794] Error Code 14: Msg: Parser configurations requested resolved uris, but uri [materials/scripts/] could not be resolved.
(2026-05-12 10:56:13.540) [error] [ServerPrivate.cc:794] Error Code 9: Msg: Failed to load a world.
(2026-05-12 10:56:13.540) [error] [ServerPrivate.cc:818] Unable to find world with name[final_prelim_02]. Downloaded models may not appear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

3 participants