{"record":{"id":"8c41b48677e901cc","repo":"pulumi/pulumi","slug":"missing-resource-type-argument","errorCode":null,"errorMessage":"Missing resource type argument","messagePattern":"Missing resource type argument","errorType":"exception","errorClass":"ResourceError","httpStatus":null,"severity":"error","filePath":"sdk/nodejs/resource.ts","lineNumber":464,"sourceCode":"        props: Inputs = {},\n        opts: ResourceOptions = {},\n        remote: boolean = false,\n        dependency: boolean = false,\n        packageRef?: Promise<string | undefined>,\n    ) {\n        this.__pulumiType = t;\n\n        if (dependency) {\n            this.__providers = {};\n            return;\n        }\n\n        if (opts.parent && !Resource.isInstance(opts.parent)) {\n            throw new Error(`Resource parent is not a valid Resource: ${opts.parent}`);\n        }\n\n        if (!t) {\n            throw new ResourceError(\"Missing resource type argument\", opts.parent);\n        }\n        if (!name) {\n            throw new ResourceError(\"Missing resource name argument (for URN creation)\", opts.parent);\n        }\n\n        // Before anything else - if there are transformations registered, invoke them in order to transform the properties and\n        // options assigned to this resource.\n        const parent = opts.parent || getStackResource();\n        this.__transformations = [...(opts.transformations || []), ...(parent?.__transformations || [])];\n        for (const transformation of this.__transformations) {\n            const tres = transformation({ resource: this, type: t, name, props, opts });\n            if (tres) {\n                if (tres.opts.parent !== opts.parent) {\n                    // This is currently not allowed because the parent tree is needed to establish what\n                    // transformation to apply in the first place, and to compute inheritance of other\n                    // resource options in the Resource constructor before transformations are run (so\n                    // modifying it here would only even partially take affect).  It's theoretically\n                    // possible this restriction could be lifted in the future, but for now just","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/nodejs/resource.ts#L446-L482","documentation":"Every Pulumi resource must be created with a type token (`t`), the first argument used to build the resource's URN. The Resource constructor throws this ResourceError when the type argument is missing/empty, because the engine cannot classify or register the resource without it.","triggerScenarios":"Subclassing `Resource`/`CustomResource` and forgetting to forward the type token to `super`; calling `new CustomResource()` directly with undefined as the first argument; a component base class that drops the type parameter.","commonSituations":"Hand-written resource classes with broken super() calls; minified/bundled code that reorders arguments; dynamic type tokens computed from variables that end up undefined.","solutions":["Ensure `super(type, name, props, opts)` receives a non-empty type string like `\"pkg:module:Name\"`.","Check that the variable holding the type token is defined at the call site.","If writing a custom component, extend `ComponentResource` and pass a valid three-part type token."],"exampleFix":"// before\nclass MyRes extends pulumi.CustomResource {\n  constructor(name, opts) { super(undefined, name, {}, opts); }\n}\n// after\nclass MyRes extends pulumi.CustomResource {\n  constructor(name, opts) { super(\"my:index:MyRes\", name, {}, opts); }\n}","handlingStrategy":"validation","validationCode":"if (typeof type !== \"string\" || type.length === 0) {\n  throw new TypeError(\"Resource type token (first constructor arg) must be a non-empty string like 'pkg:module:Name'\");\n}","typeGuard":"function isTypeToken(v: unknown): v is string {\n  return typeof v === \"string\" && /^[a-zA-Z0-9-]+:[a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/.test(v);\n}","tryCatchPattern":"try {\n  super(type, name, props, opts);\n} catch (e) {\n  if (e instanceof pulumi.ResourceError && /Missing resource type argument/.test(e.message)) {\n    throw new Error(\"Subclass failed to forward a valid type token to super()\");\n  }\n  throw e;\n}","preventionTips":["Always forward all super() args in custom resource subclasses","Use typed constants for type tokens","Enable strict TypeScript so undefined cannot silently flow into super()"],"tags":["nodejs","resource","missing-argument"],"backgroundTag":"missing-resource-type","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}