Skip to content

RSDK-14517 Reject non-string motion resource names with an explicit TypeError - #1258

Open
viambot wants to merge 3 commits into
mainfrom
claude/RSDK-14517/motion-accept-resource-name
Open

RSDK-14517 Reject non-string motion resource names with an explicit TypeError#1258
viambot wants to merge 3 commits into
mainfrom
claude/RSDK-14517/motion-accept-resource-name

Conversation

@viambot

@viambot viambot commented Sep 8, 2026

Copy link
Copy Markdown
Member

Problem

MotionClient.move and MotionClient.get_pose take component_name as a plain string. Older SDK releases took a ResourceName, and that is the form older examples (and agents trained on them) still use. Passing a ResourceName today fails inside the protobuf C extension with a message that names neither the field nor the expected type:

TypeError: bad argument type for built-in operation

This was observed in 12 of 12 cold agent runs against a Viam machine: every run's first Move/GetPose call passed a ResourceName, hit that error, and then burned time inspecting the signature before retrying with a string.

Change

Per the second option in the Jira item, the parameters stay string-only and the client rejects anything else up front with the error text from the ticket:

TypeError: component_name must be the component's name as a string, e.g. 'pick-grip'

Applied to every parameter in the motion client that took a ResourceName in older releases, so a copied old call site does not just fail one argument later:

  • move, get_pose, stop_plan, get_plancomponent_name
  • move_on_globecomponent_name, movement_sensor_name
  • move_on_mapcomponent_name, slam_service_name

No signature, type-hint, or wire-format changes: valid string calls behave exactly as before, and the Motion abstract interface and service side are untouched.

One deliberate deviation from the ticket's wording: the check is an explicit isinstance test on the parameter rather than a try/except TypeError around the request construction. Catching there would also swallow type errors raised by other fields (for example a bad destination) and mislabel them as a bad component_name. The observable behavior for the reported case is identical. Happy to switch to the literal catch if you prefer it.

Tests

Added to tests/test_motion_service.py: move and get_pose raise the new message when handed a ResourceName, and move_on_globe names movement_sensor_name when that is the bad argument. Existing tests cover the string path.

pytest, ruff check, ruff format, and pyright pass. (tests/test_native.py, tests/test_rpc.py and tests/test_spatialmath.py fail in this sandbox only because libviam_rust_utils.so could not be downloaded; unrelated to this change.)

Note

Companion TypeScript fix: viamrobotics/viam-typescript-sdk#1001. There the same call is not rejected by protobuf-es at all — a ResourceName is serialized as '[object Object]' and sent to the machine as the component name.

Key: RSDK-14517

Co-authored by Claude agent for Jira.

MotionClient.move/get_pose and friends take resource names as plain strings.
Passing a ResourceName, which older SDK releases accepted, failed inside the
protobuf C extension with 'TypeError: bad argument type for built-in operation',
naming neither the field nor the expected type.

The client now accepts a ResourceName (or any object with a string .name) and
uses its name, and raises a TypeError naming the parameter for anything else.
Switches from coercing a ResourceName to rejecting it, per the second option
in the ticket: the parameters stay string-only and the client raises a
TypeError that names the field and the expected type instead of the protobuf
extension's 'bad argument type for built-in operation'.
@viambot viambot changed the title RSDK-14517 Accept a ResourceName for motion client resource name params RSDK-14517 Reject non-string motion resource names with an explicit TypeError Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants