{"record":{"id":"510fdf9b970ef63c","repo":"boto/boto3","slug":"self-class-name-has-no-load-method","errorCode":null,"errorMessage":"{self.__class__.__name__} has no load method","messagePattern":"(.+?) has no load method","errorType":"exception","errorClass":"ResourceLoadException","httpStatus":null,"severity":"error","filePath":"boto3/resources/factory.py","lineNumber":383,"sourceCode":"        snake_cased,\n        member_model,\n        service_context,\n    ):\n        \"\"\"\n        Creates a new property on the resource to lazy-load its value\n        via the resource's ``load`` method (if it exists).\n        \"\"\"\n\n        # The property loader will check to see if this resource has already\n        # been loaded and return the cached value if possible. If not, then\n        # it first checks to see if it CAN be loaded (raise if not), then\n        # calls the load before returning the value.\n        def property_loader(self):\n            if self.meta.data is None:\n                if hasattr(self, 'load'):\n                    self.load()\n                else:\n                    raise ResourceLoadException(\n                        f'{self.__class__.__name__} has no load method'\n                    )\n\n            return self.meta.data.get(name)\n\n        property_loader.__name__ = str(snake_cased)\n        property_loader.__doc__ = docstring.AttributeDocstring(\n            service_name=service_context.service_name,\n            resource_name=resource_name,\n            attr_name=snake_cased,\n            event_emitter=factory_self._emitter,\n            attr_model=member_model,\n            include_signature=False,\n        )\n\n        return property(property_loader)\n\n    def _create_waiter(","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/boto/boto3/blob/6e10b029c1326a437932a8b24f38af69fd986e15/boto3/resources/factory.py#L365-L401","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Load the resource explicitly via the parent collection or a service call that returns populated data (e.g. get_existing_resource, query, scan).","Check hasattr(resource, 'load') before accessing data attributes.","Use the low-level client call and read the response field directly if the resource has no load method."],"exampleFix":"# before\nobj = s3.Object('bkt', 'key')\nsize = obj.size  # may raise if not loaded and no load method\n# after\nobj = s3.Object('bkt', 'key')\nobj.load()  # explicit fetch via HeadObject\nsize = obj.size","handlingStrategy":"try-catch","validationCode":"def safe_get(res, attr):\n    if res.meta.data is None and not hasattr(res, 'load'):\n        return None  # cannot be loaded\n    return getattr(res, attr)","typeGuard":"def is_loadable(res) -> bool:\n    return hasattr(res, 'load')","tryCatchPattern":"from boto3.exceptions import ResourceLoadException\ntry:\n    val = res.some_attribute\nexcept ResourceLoadException:\n    # fall back to an explicit service call\n    val = client.describe_x(Identifier=res.id)['x']","preventionTips":["Call resource.load() explicitly when supported.","Acquire resources from collections that populate meta.data.","Use low-level client calls when a resource has no load action."],"tags":["resources","lazy-load","factory","boto3"],"backgroundTag":null,"analyzedSha":"6e10b029c1326a437932a8b24f38af69fd986e15","analyzedAt":"2026-08-11T20:52:47.213Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}