{"record":{"id":"13807ee3da866a14","repo":"pulumi/pulumi","slug":"subclass-of-resourceprovider-must-implement-creat","errorCode":null,"errorMessage":"Subclass of ResourceProvider must implement 'create'","messagePattern":"Subclass of ResourceProvider must implement 'create'","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"sdk/python/lib/pulumi/dynamic/dynamic.py","lineNumber":239,"sourceCode":"\n    def diff(\n        self,\n        _id: str,\n        _olds: dict[str, Any],\n        _news: dict[str, Any],\n    ) -> DiffResult:\n        \"\"\"\n        Diff checks what impacts a hypothetical update will have on the resource's properties.\n        \"\"\"\n        return DiffResult()\n\n    def create(self, props: dict[str, Any]) -> CreateResult:\n        \"\"\"\n        Create allocates a new instance of the provided resource and returns its unique ID\n        afterwards. If this call fails, the resource must not have been created (i.e., it is\n        \"transactional\").\n        \"\"\"\n        raise Exception(\"Subclass of ResourceProvider must implement 'create'\")\n\n    def read(self, id_: str, props: dict[str, Any]) -> ReadResult:\n        \"\"\"\n        Reads the current live state associated with a resource.  Enough state must be included in\n        the inputs to uniquely identify the resource; this is typically just the resource ID, but it\n        may also include some properties.\n        \"\"\"\n        return ReadResult(id_, props)\n\n    def update(\n        self,\n        _id: str,\n        _olds: dict[str, Any],\n        _news: dict[str, Any],\n    ) -> UpdateResult:\n        \"\"\"\n        Update updates an existing resource with new values.\n        \"\"\"","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/python/lib/pulumi/dynamic/dynamic.py#L221-L257","documentation":"ResourceProvider.create is an abstract-like base method that raises Exception when called. The dynamic provider runtime invokes create() on your subclass; if the subclass did not override it, this error surfaces at deployment time. Only create is strictly mandatory (read/diff/update have defaults).","triggerScenarios":"Subclassing pulumi.dynamic.ResourceProvider and registering a dynamic resource without defining a create method, then creating that resource in a stack.","commonSituations":"Copy-pasting a provider class and forgetting create; renaming create misspelled (e.g. Create) so the override doesn't bind; scaffolding a provider before implementing CRUD.","solutions":["Implement create(self, props) returning a dynamic.CreateResult(id_, outs={...}) on the subclass","Check method spelling/casing matches exactly 'create'","Use a base class or linter (abstract check) to ensure required methods are implemented before deploying"],"exampleFix":"// before\nclass Prov(dynamic.ResourceProvider):\n    def update(self, id, olds, news): ...\n// after\nclass Prov(dynamic.ResourceProvider):\n    def create(self, props):\n        return dynamic.CreateResult(id_='my-id', outs=props)","handlingStrategy":"validation","validationCode":"class Prov(dynamic.ResourceProvider):\n    def create(self, props):\n        return dynamic.CreateResult(id_='id', outs=props)\n\nassert isinstance(getattr(Prov, 'create'), type(Prov.create)) and Prov.create is not dynamic.ResourceProvider.create, 'override create()'","typeGuard":"def implements_create(cls):\n    return cls.create is not dynamic.ResourceProvider.create","tryCatchPattern":"try:\n    MyRes('r', props)\nexcept Exception as e:\n    if \"must implement 'create'\" in str(e):\n        raise TypeError('ResourceProvider subclass missing create()') from e","preventionTips":["Always implement create() returning dynamic.CreateResult","Keep method names lowercase and exactly spelled","Add a unit test instantiating and calling provider.create","Lint for classes inheriting ResourceProvider without overriding create"],"tags":["python","dynamic-provider","subclass"],"backgroundTag":"unimplemented-abstract-method","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}