boto/boto3 · error · ResourceLoadException
{self.__class__.__name__} has no load method
Error message
{self.__class__.__name__} has no load method What it means
Raised by the auto-loaded property created in _create_autoload_property when meta.data is None (the resource has not been hydrated) and the resource class has no load method. The property loader checks hasattr(self, 'load'); if absent, it cannot fetch data to satisfy the attribute access, so ResourceLoadException is raised. Not every resource model defines a load action; those that do not cannot lazy-load attributes.
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 c7b4afac23)
Solutions
- Hydrate the resource explicitly by performing a describing action (e.g. obj = bucket.Object('k'); obj.get()) so meta.data is populated.
- Check hasattr(resource, 'load') before accessing data attributes.
- Use the low-level client to fetch the data if the resource has no load action.
Example fix
# before
obj = s3.Object('mybucket', 'k')
print(obj.last_modified) # no data, no load method -> error
# after
obj = s3.Object('mybucket', 'k')
obj.load() # or obj.get() then re-access
print(obj.last_modified)
# guard:
if hasattr(obj, 'load'):
obj.load() Defensive patterns
Strategy: try-catch
Validate before calling
def safe_get_attr(resource, attr_name):
if resource.meta.data is None:
if hasattr(resource, 'load'):
resource.load()
else:
return None
return getattr(resource, attr_name, None) Type guard
def can_load(resource) -> bool:
return hasattr(resource, 'load') or resource.meta.data is not None Try / catch
from boto3.exceptions import ResourceLoadException
try:
val = resource.some_attribute
except ResourceLoadException:
# resource has no load method; fetch via client or skip
val = resource.meta.client.get_object(Bucket=..., Key=...) Prevention
- Always call .load() (or a describing action) before reading data attributes on identifier-only resources.
- Guard attribute access with hasattr(resource, 'load').
- Know which resource types lack a load action in the service model.
When it happens
Trigger: Accessing a data attribute (e.g. obj.last_modified) on a resource that was constructed without data and whose model has no load action. E.g. some S3 Object sub-resources or relation-only resources.
Common situations: Constructing a resource from identifiers only and then reading a data field; accessing attributes on a resource type that the service model marks as having no load; calling .load() implicitly via property access after a failed/empty response.
Related errors
- {parent.__class__.__name__} has no load method!
- Unknown keyword argument: {name}
- Required parameter {identifier} not set
- Unsupported source type: {source}
- Unsupported source type: {source}
AI-assisted analysis of boto/boto3@c7b4afac23 (2026-08-04).
Data as JSON: /data/errors/510fdf9b970ef63c.json.
Report an issue: GitHub.