boto/boto3 · error · ResourceLoadException

has no load method!

Error message

{parent.__class__.__name__} has no load method!

What it means

get_data_member loads parent.meta.data on demand and then runs a JMESPath query. If parent.meta.data is None and the parent resource has no load method, it raises ResourceLoadException('{parent class} has no load method!'). This typically occurs while building request parameters that reference a data member of a resource that has never been fetched.

Solutions

  1. Call parent.load() (when supported) before invoking actions that depend on its data members.
  2. Acquire the parent from a collection/query that projects the required field so meta.data is populated.
  3. Use the low-level client API and pass identifiers explicitly to avoid the data-member dependency.

Example fix

# before
inst = ec2.Instance('i-123')
inst.terminate()  # if terminate references a data member, raises
# after
inst = ec2.Instance('i-123')
inst.load()
inst.terminate()
Defensive patterns

Strategy: try-catch

Validate before calling

def ensure_loaded(res):
    if res.meta.data is None:
        assert hasattr(res, 'load'), f'{res.__class__.__name__} cannot be loaded'
        res.load()
    return res

Type guard

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

Try / catch

from boto3.exceptions import ResourceLoadException
try:
    res.action()
except ResourceLoadException:
    data = client.describe_x(Identifier=res.id)
    res.meta.data = data  # populate then retry

Prevention

When it happens

Trigger: Calling an action whose parameters source='data' on a resource whose data has not been loaded and that has no load action; chaining resource actions on a freshly constructed parent.

Common situations: Constructing a resource via its constructor (identifiers only) and immediately invoking a related action that depends on a data member; partial population from a list call that did not project the needed field.

Related errors


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

Appendix: source

Thrown at boto3/resources/params.py:44

    Get a data member from a parent using a JMESPath search query,
    loading the parent if required. If the parent cannot be loaded
    and no data is present then an exception is raised.

    :type parent: ServiceResource
    :param parent: The resource instance to which contains data we
                   are interested in.
    :type path: string
    :param path: The JMESPath expression to query
    :raises ResourceLoadException: When no data is present and the
                                   resource cannot be loaded.
    :returns: The queried data or ``None``.
    """
    # Ensure the parent has its data loaded, if possible.
    if parent.meta.data is None:
        if hasattr(parent, 'load'):
            parent.load()
        else:
            raise ResourceLoadException(
                f'{parent.__class__.__name__} has no load method!'
            )

    return jmespath.search(path, parent.meta.data)


def create_request_parameters(parent, request_model, params=None, index=None):
    """
    Handle request parameters that can be filled in from identifiers,
    resource data members or constants.

    By passing ``params``, you can invoke this method multiple times and
    build up a parameter dict over time, which is particularly useful
    for reverse JMESPath expressions that append to lists.

    :type parent: ServiceResource
    :param parent: The resource instance to which this action is attached.
    :type request_model: :py:class:`~boto3.resources.model.Request`

View on GitHub (pinned to 6e10b029c1)