{"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/c7b4afac237b976d48395d7523eaf7cec3a450b3/boto3/resources/params.py#L26-L62","documentation":"Raised by get_data_member() in boto3/resources/params.py when a request-parameter or identifier path requires data from a parent resource, meta.data is None, and the parent has no load method. This is the same root cause as error 16 but triggered internally during create_request_parameters — i.e. when building the arguments for a resource action that references a 'data' source and the parent was never hydrated.","triggerScenarios":"Calling an action on a resource whose request model references a data member of the parent, when the parent has no load action and no cached data. E.g. invoking a relation/action that needs parent.some_field where parent was built from identifiers only.","commonSituations":"Chaining resource actions on identifier-only parent resources that lack a load method; service-model definitions where a data member is referenced but the resource cannot self-load.","solutions":["Hydrate the parent before invoking the action: parent.load() if available, or perform a describing call first.","Construct the parent from a response that already includes data (e.g. via a list/collection).","Fall back to the low-level client to supply the needed parameter explicitly."],"exampleFix":"# before\nparent = some_resource(id='x')\nparent.related_action()  # action needs parent.data_field, no load -> error\n\n# after\nparent = some_resource(id='x')\nif hasattr(parent, 'load'):\n    parent.load()\nparent.related_action()","handlingStrategy":"try-catch","validationCode":"def ensure_loaded(resource):\n    if resource.meta.data is None and hasattr(resource, 'load'):\n        resource.load()\n    return resource","typeGuard":"def can_load(resource) -> bool:\n    return hasattr(resource, 'load') or resource.meta.data is not None","tryCatchPattern":"from boto3.exceptions import ResourceLoadException\ntry:\n    parent.related_action()\nexcept ResourceLoadException:\n    # hydrate or use low-level client\n    parent.meta.client.some_api_call(...)","preventionTips":["Hydrate parent resources (load or describe) before triggering actions that reference their data.","Build parents from collection/list responses so meta.data is already populated.","Be aware of which resource actions have 'data' source params in the model."],"tags":["resources","lazy-load","resource-load-exception","params","request-building"],"analyzedSha":"c7b4afac237b976d48395d7523eaf7cec3a450b3","analyzedAt":"2026-08-04T20:35:51.598Z","schemaVersion":2}