{"record":{"id":"6563e5fcf9a924a0","repo":"boto/boto3","slug":"required-parameter-identifier-not-set","errorCode":null,"errorMessage":"Required parameter {identifier} not set","messagePattern":"Required parameter (.+?) not set","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"boto3/resources/base.py","lineNumber":123,"sourceCode":"        # in which they were defined in the ResourceJSON.\n        for i, value in enumerate(args):\n            setattr(self, f\"_{self.meta.identifiers[i]}\", value)\n\n        # Allow setting identifiers via keyword arguments. Here we need\n        # extra logic to ignore other keyword arguments like ``client``.\n        for name, value in kwargs.items():\n            if name == 'client':\n                continue\n\n            if name not in self.meta.identifiers:\n                raise ValueError(f'Unknown keyword argument: {name}')\n\n            setattr(self, f\"_{name}\", value)\n\n        # Validate that all identifiers have been set.\n        for identifier in self.meta.identifiers:\n            if getattr(self, identifier) is None:\n                raise ValueError(f'Required parameter {identifier} not set')\n\n    def __repr__(self):\n        identifiers = [\n            f'{identifier}={repr(getattr(self, identifier))}'\n            for identifier in self.meta.identifiers\n        ]\n        return f\"{self.__class__.__name__}({', '.join(identifiers)})\"\n\n    def __eq__(self, other):\n        # Should be instances of the same resource class\n        if other.__class__.__name__ != self.__class__.__name__:\n            return False\n\n        # Each of the identifiers should have the same value in both\n        # instances, e.g. two buckets need the same name to be equal.\n        for identifier in self.meta.identifiers:\n            if getattr(self, identifier) != getattr(other, identifier):\n                return False","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/boto/boto3/blob/6e10b029c1326a437932a8b24f38af69fd986e15/boto3/resources/base.py#L105-L141","documentation":"After processing positional and keyword arguments, Resource.__init__ verifies every declared identifier received a non-None value. If any identifier is still None, it raises ValueError('Required parameter {identifier} not set'). This catches incomplete construction before the resource is used in a service call that would fail server-side.","triggerScenarios":"Constructing a resource that needs multiple identifiers (e.g. S3 Object requires bucket_name and key) but only supplying some; passing positional args in the wrong order so a later identifier stays None.","commonSituations":"Forgetting the second identifier for resources keyed by (bucket, key), (instance_id, device), etc.; mis-ordering positional args.","solutions":["Provide all declared identifiers — check Resource.meta.identifiers for the required set and order.","Use keyword arguments to avoid positional-order mistakes.","Acquire the resource from a parent or collection (e.g. bucket.Object(key=...)) which fills in identifiers automatically."],"exampleFix":"# before\nobj = s3.Object('my-bucket')  # missing 'key'\n# after\nobj = s3.Object('my-bucket', 'path/to/file.txt')\n# or\nobj = s3.Object(bucket_name='my-bucket', key='path/to/file.txt')","handlingStrategy":"validation","validationCode":"def build_resource(cls, *args, **kwargs):\n    ids = list(cls.meta.identifiers)\n    provided = list(args) + [kwargs.get(i) for i in ids[len(args):]]\n    missing = [i for i, v in zip(ids, provided) if v is None]\n    assert not missing, f'Missing required identifiers: {missing}'\n    return cls(*args, **kwargs)","typeGuard":"def all_identifiers_set(cls, args, kwargs) -> bool:\n    ids = list(cls.meta.identifiers)\n    if len(args) >= len(ids):\n        return True\n    return all(kwargs.get(i) is not None for i in ids[len(args):])","tryCatchPattern":"try:\n    res = svc.Resource(*args, **kwargs)\nexcept ValueError as e:\n    if 'not set' in str(e):\n        # fetch identifiers from parent/collection\n        res = parent.Resource(id_arg=known_id)\n    else:\n        raise","preventionTips":["Check Resource.meta.identifiers to learn required names and order.","Use keyword args to avoid positional-order bugs.","Acquire resources via collections that fill identifiers."],"tags":["resources","factory","identifier","boto3"],"backgroundTag":null,"analyzedSha":"6e10b029c1326a437932a8b24f38af69fd986e15","analyzedAt":"2026-08-11T20:52:47.213Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}