{"record":{"id":"494b2cb07e975818","repo":"pulumi/pulumi","slug":"resource-name-is-not-available-this-resource-inst","errorCode":null,"errorMessage":"Resource name is not available, this resource instance must have been constructed by an old SDK","messagePattern":"Resource name is not available, this resource instance must have been constructed by an old SDK","errorType":"exception","errorClass":"ResourceError","httpStatus":null,"severity":"error","filePath":"sdk/nodejs/resource.ts","lineNumber":1912,"sourceCode":"    if (parts.length === 3) {\n        return parts[0];\n    }\n    return undefined;\n}\n\n/**\n * The Pulumi type assigned to the resource at construction, of the form `package:module:name`.\n */\nexport function resourceType(res: Resource): string {\n    return res.__pulumiType;\n}\n\n/**\n * The Pulumi name assigned to the resource at construction, i.e. the \"name\" in its constructor call.\n */\nexport function resourceName(res: Resource): string {\n    if (res.__name === undefined) {\n        throw new ResourceError(\n            \"Resource name is not available, this resource instance must have been constructed by an old SDK\",\n            res,\n        );\n    }\n    return res.__name;\n}\n","sourceCodeStart":1894,"sourceCodeEnd":1919,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/nodejs/resource.ts#L1894-L1919","documentation":"The SDK records the constructor-time name on each resource instance in the internal __name field. resourceName() throws this error when that field is undefined, which can only happen if the instance was created by an SDK version that predates this field. It guards against silent misbehavior when engine callbacks inspect resources from an old SDK.","triggerScenarios":"Mixing SDK versions in one program (e.g. a dependency library constructing resources with an old @pulumi/pulumi while the runtime uses a newer one), so resourceName() is called on an instance lacking __name.","commonSituations":"Stale node_modules with duplicate @pulumi/pulumi copies at different versions; a provider SDK package pinning an ancient @pulumi/pulumi dependency; partially upgraded monorepos.","solutions":["Upgrade the dependency package that constructs the resource to use a current @pulumi/pulumi version","Deduplicate @pulumi/pulumi with 'npm ls @pulumi/pulumi' and resolve so only one version is installed","Re-run 'npm install' / lockfile update so the provider code and runtime share the same SDK"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if (typeof (res as any).__name === \"undefined\") { throw new Error(\"resource built by old SDK\"); }","typeGuard":"function hasResourceName(res: pulumi.Resource): res is pulumi.Resource & { __name: string } { return typeof (res as any).__name === \"string\"; }","tryCatchPattern":null,"preventionTips":["Keep a single @pulumi/pulumi version across the program and dependencies","Run 'npm ls @pulumi/pulumi' to detect duplicate versions","Upgrade provider libraries alongside the CLI"],"tags":["nodejs","sdk-versioning","resources"],"backgroundTag":"sdk-version-mismatch","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}