Skip to content

Have an error if a device composite is not found in the blueapi context #1526

Open

Description

@noemifrisina

When injecting a device composite instead of a single device, if the composite has not been added to the module and not discoverable by blueapi, the only error that will show up on the blueapi logs is a PydanticInvalidForJsonSchema pointing to the first device in the composite, eg

raise self._value
pydantic.errors.PydanticInvalidForJsonSchema: Cannot generate a JsonSchema for core_schema.IsInstanceSchema (<class 'dodal.devices.beamlines.i19.diffractometer.FourCircleDiffractometer'>)

This is a bit confusing because it doesn't really give any information about where the error might be - in particular when the device otherwise connects and is used in other plans.

Related to #1525 . Run into this while testing on I19 and couldn't figure out what was missing until I took a look at the planFunctions module used in hyperion.

Activity

  1. tpoliaw commented on May 5, 2026

    @tpoliaw
    Contributor

    I'm not sure how this can be related to not having the composite type imported. Without the import blueapi will fail to import the module with eg NameError: name 'DemoComposite' is not defined.

    One way I could see this error being raised is if the composite doesn't have allow_arbitrary_types=True in its config. At that point, any field that wasn't serialisable (most devices) would cause a "Cannot create JsonSchema` error.

    Do you have an example of the plan module that was causing the problem?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions