boto/boto3 · error · ValueError
Required parameter {identifier} not set
Error message
Required parameter {identifier} not set What it means
Raised by ServiceResource.__init__ during the final validation loop: after processing all positional and keyword arguments, it checks every identifier in meta.identifiers; if any is still None, the resource cannot address a specific AWS entity and construction is aborted. This catches incomplete resource instantiation.
Source
Thrown at boto3/resources/base.py:123
# in which they were defined in the ResourceJSON.
for i, value in enumerate(args):
setattr(self, f"_{self.meta.identifiers[i]}", value)
# Allow setting identifiers via keyword arguments. Here we need
# extra logic to ignore other keyword arguments like ``client``.
for name, value in kwargs.items():
if name == 'client':
continue
if name not in self.meta.identifiers:
raise ValueError(f'Unknown keyword argument: {name}')
setattr(self, f"_{name}", value)
# Validate that all identifiers have been set.
for identifier in self.meta.identifiers:
if getattr(self, identifier) is None:
raise ValueError(f'Required parameter {identifier} not set')
def __repr__(self):
identifiers = [
f'{identifier}={repr(getattr(self, identifier))}'
for identifier in self.meta.identifiers
]
return f"{self.__class__.__name__}({', '.join(identifiers)})"
def __eq__(self, other):
# Should be instances of the same resource class
if other.__class__.__name__ != self.__class__.__name__:
return False
# Each of the identifiers should have the same value in both
# instances, e.g. two buckets need the same name to be equal.
for identifier in self.meta.identifiers:
if getattr(self, identifier) != getattr(other, identifier):
return FalseView on GitHub (pinned to c7b4afac23)
Solutions
- Supply every required identifier: s3.Object(bucket_name='b', key='k').
- Use parent-resource accessors (bucket.Object(key='k')) which inject the parent identifier automatically.
- Check resource.meta.identifiers and ensure none is None before or after construction.
Example fix
# before
obj = s3.Object(key='k') # missing bucket
# after
obj = s3.Object(bucket_name='mybucket', key='k')
# or via parent
obj = s3.Bucket('mybucket').Object('k') Defensive patterns
Strategy: validation
Validate before calling
def build_resource(resource_cls, **kwargs):
missing = [i for i in resource_cls.meta.identifiers if kwargs.get(i) is None]
if missing:
raise ValueError(f'Missing required identifiers: {missing}')
return resource_cls(**kwargs) Type guard
def all_identifiers_set(resource) -> bool:
return all(getattr(resource, i) is not None for i in resource.meta.identifiers) Prevention
- Prefer parent-resource accessors (Bucket().Object()) to avoid omitting inherited identifiers.
- Programmatically assert every meta.identifiers value is non-None before constructing.
- Log the identifier list for each resource type at startup.
When it happens
Trigger: s3.Object(key='k') — missing 'bucket' identifier. Also constructing a resource with fewer positional args than required identifiers, or passing an identifier as None explicitly.
Common situations: Building a child resource without supplying the parent identifier; optional fields mistaken for identifiers; programmatic resource creation where a loop omits one field.
Related errors
- Unknown keyword argument: {name}
- {self.__class__.__name__} has no load method
- {parent.__class__.__name__} has no load method!
- Unsupported source type: {source}
- Unsupported source type: {source}
AI-assisted analysis of boto/boto3@c7b4afac23 (2026-08-04).
Data as JSON: /data/errors/6563e5fcf9a924a0.json.
Report an issue: GitHub.