{"record":{"id":"7cce716294f7ee5c","repo":"boto/boto3","slug":"parent-class-name-has-no-load-method","errorCode":null,"errorMessage":"{parent.__class__.__name__} has no load method!","messagePattern":"(.+?) has no load method!","errorType":"exception","errorClass":"ResourceLoadException","httpStatus":null,"severity":"error","filePath":"boto3/resources/params.py","lineNumber":44,"sourceCode":"    Get a data member from a parent using a JMESPath search query,\n    loading the parent if required. If the parent cannot be loaded\n    and no data is present then an exception is raised.\n\n    :type parent: ServiceResource\n    :param parent: The resource instance to which contains data we\n                   are interested in.\n    :type path: string\n    :param path: The JMESPath expression to query\n    :raises ResourceLoadException: When no data is present and the\n                                   resource cannot be loaded.\n    :returns: The queried data or ``None``.\n    \"\"\"\n    # Ensure the parent has its data loaded, if possible.\n    if parent.meta.data is None:\n        if hasattr(parent, 'load'):\n            parent.load()\n        else:\n            raise ResourceLoadException(\n                f'{parent.__class__.__name__} has no load method!'\n            )\n\n    return jmespath.search(path, parent.meta.data)\n\n\ndef create_request_parameters(parent, request_model, params=None, index=None):\n    \"\"\"\n    Handle request parameters that can be filled in from identifiers,\n    resource data members or constants.\n\n    By passing ``params``, you can invoke this method multiple times and\n    build up a parameter dict over time, which is particularly useful\n    for reverse JMESPath expressions that append to lists.\n\n    :type parent: ServiceResource\n    :param parent: The resource instance to which this action is attached.\n    :type request_model: :py:class:`~boto3.resources.model.Request`","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/boto/boto3/blob/6e10b029c1326a437932a8b24f38af69fd986e15/boto3/resources/params.py#L26-L62","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Call parent.load() (when supported) before invoking actions that depend on its data members.","Acquire the parent from a collection/query that projects the required field so meta.data is populated.","Use the low-level client API and pass identifiers explicitly to avoid the data-member dependency."],"exampleFix":"# before\ninst = ec2.Instance('i-123')\ninst.terminate()  # if terminate references a data member, raises\n# after\ninst = ec2.Instance('i-123')\ninst.load()\ninst.terminate()","handlingStrategy":"try-catch","validationCode":"def ensure_loaded(res):\n    if res.meta.data is None:\n        assert hasattr(res, 'load'), f'{res.__class__.__name__} cannot be loaded'\n        res.load()\n    return res","typeGuard":"def is_loadable(res) -> bool:\n    return hasattr(res, 'load')","tryCatchPattern":"from boto3.exceptions import ResourceLoadException\ntry:\n    res.action()\nexcept ResourceLoadException:\n    data = client.describe_x(Identifier=res.id)\n    res.meta.data = data  # populate then retry","preventionTips":["Call load() before invoking actions that read data members.","Project required fields when listing resources.","Use low-level client calls to avoid data-member dependencies."],"tags":["resources","lazy-load","params","boto3"],"backgroundTag":null,"analyzedSha":"6e10b029c1326a437932a8b24f38af69fd986e15","analyzedAt":"2026-08-11T20:52:47.213Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}