boto/boto3 · error · ResourceLoadException

has no load method

Error message

{self.__class__.__name__} has no load method

What it means

Generated resource properties are backed by property_loader, which lazily loads the resource's data on first access. If self.meta.data is None and the resource class has no load method (some resources have no load action defined in the model), accessing the property raises ResourceLoadException('{class} has no load method'). This means the property cannot be populated from the service.

Solutions

  1. Load the resource explicitly via the parent collection or a service call that returns populated data (e.g. get_existing_resource, query, scan).
  2. Check hasattr(resource, 'load') before accessing data attributes.
  3. Use the low-level client call and read the response field directly if the resource has no load method.

Example fix

# before
obj = s3.Object('bkt', 'key')
size = obj.size  # may raise if not loaded and no load method
# after
obj = s3.Object('bkt', 'key')
obj.load()  # explicit fetch via HeadObject
size = obj.size
Defensive patterns

Strategy: try-catch

Validate before calling

def safe_get(res, attr):
    if res.meta.data is None and not hasattr(res, 'load'):
        return None  # cannot be loaded
    return getattr(res, attr)

Type guard

def is_loadable(res) -> bool:
    return hasattr(res, 'load')

Try / catch

from boto3.exceptions import ResourceLoadException
try:
    val = res.some_attribute
except ResourceLoadException:
    # fall back to an explicit service call
    val = client.describe_x(Identifier=res.id)['x']

Prevention

When it happens

Trigger: Accessing an attribute of a resource that was constructed from identifiers alone (no data loaded) and whose model defines no load action, e.g. some sub-resources or reference-only resources.

Common situations: Constructing a resource directly via its constructor and reading a data member instead of fetching it through the service; relying on auto-load for resources that do not support it.

Related errors


AI-assisted analysis of boto/boto3@6e10b029c1 (2026-08-11). Data as JSON: /api/errors/510fdf9b970ef63c. Report an issue: GitHub.

Appendix: source

Thrown at boto3/resources/factory.py:383

        snake_cased,
        member_model,
        service_context,
    ):
        """
        Creates a new property on the resource to lazy-load its value
        via the resource's ``load`` method (if it exists).
        """

        # The property loader will check to see if this resource has already
        # been loaded and return the cached value if possible. If not, then
        # it first checks to see if it CAN be loaded (raise if not), then
        # calls the load before returning the value.
        def property_loader(self):
            if self.meta.data is None:
                if hasattr(self, 'load'):
                    self.load()
                else:
                    raise ResourceLoadException(
                        f'{self.__class__.__name__} has no load method'
                    )

            return self.meta.data.get(name)

        property_loader.__name__ = str(snake_cased)
        property_loader.__doc__ = docstring.AttributeDocstring(
            service_name=service_context.service_name,
            resource_name=resource_name,
            attr_name=snake_cased,
            event_emitter=factory_self._emitter,
            attr_model=member_model,
            include_signature=False,
        )

        return property(property_loader)

    def _create_waiter(

View on GitHub (pinned to 6e10b029c1)