{"record":{"id":"23f926e31c66376d","repo":"pulumi/pulumi","slug":"unknown-resource-v","errorCode":null,"errorMessage":"unknown resource %v","messagePattern":"unknown resource (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resource/deploy/builtins.go","lineNumber":454,"sourceCode":"\treturn property.NewMap(map[string]property.Value{\n\t\t\"name\":    name,\n\t\t\"outputs\": property.New(outputs),\n\t}), nil\n}\n\nfunc (p *builtinProvider) getResource(inputs property.Map) (property.Map, error) {\n\turnInput, ok := inputs.GetOk(\"urn\")\n\tcontract.Assertf(ok, \"missing required property 'urn'\")\n\tcontract.Assertf(urnInput.IsString(), \"expected 'urn' to be a string\")\n\n\t// When looking up a resource to hydrate it, we'll first check for new states produced by resource registrations. If\n\t// we fail to find a match there, we'll look for states that have been read.\n\turn := resource.URN(urnInput.AsString())\n\tstate, ok := p.news.Load(urn)\n\tif !ok {\n\t\tstate, ok = p.reads.Load(urn)\n\t\tif !ok {\n\t\t\treturn property.Map{}, fmt.Errorf(\"unknown resource %v\", urnInput.AsString())\n\t\t}\n\t}\n\n\t// Take the state lock so we can safely read the Outputs.\n\tstate.Lock.Lock()\n\tdefer state.Lock.Unlock()\n\n\treturn property.NewMap(map[string]property.Value{\n\t\t\"urn\":      urnInput,\n\t\t\"id\":       property.New(string(state.ID)),\n\t\t\"provider\": property.New(state.Provider),\n\t\t\"state\":    property.New(resource.FromResourcePropertyMap(state.Outputs)),\n\t}), nil\n}\n","sourceCodeStart":436,"sourceCodeEnd":469,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/resource/deploy/builtins.go#L436-L469","documentation":"The pulumi:pulumi:getResource builtin invoke looks up a resource's registered outputs by URN among resources created (news) or read (reads) during the current deployment. If the given URN was not registered in either map, the resource is unknown to the engine and this error is returned.","triggerScenarios":"Invoking pulumi:pulumi:getResource with a urn argument that does not match any resource created or read in the current update — e.g. a stale/typo'd URN, or querying before the resource has been registered.","commonSituations":"Programs calling pulumi.getResource with a hand-built URN string; referencing a resource from a different stack/update; the target resource was deleted or renamed; runtime ordering where getResource runs before the resource exists.","solutions":["Pass the URN of a resource created in the current deployment (ideally derive it from the resource object, not a string literal)","Verify the URN string exactly matches type:name including stack/project prefixes","Ensure the getResource call happens after the target resource is registered (not in a pre-deploy step)","If the resource is from another stack, use getStackOutputs/getStackResourceOutputs instead"],"exampleFix":"// before\npulumi.getResource({ urn: \"urn:pulumi:dev::proj::aws:s3/bucket:Bucket::wrong-name\" })\n// after: use the actual resource's URN\nconst res = new aws.s3.Bucket(\"b\")\n// after creation: invoke with res.urn","handlingStrategy":"validation","validationCode":"// go: ensure the URN belongs to this deployment before lookup\nif !strings.HasPrefix(urn.String(), d.baseStackURNPrefix) { return fmt.Errorf(\"URN %s is not from this stack\", urn) }","typeGuard":"func isKnownURN(urn resource.URN, news, reads *sync.Map) bool { _, ok1 := news.Load(urn); _, ok2 := reads.Load(urn); return ok1 || ok2 }","tryCatchPattern":"state, err := lookupRegisteredURN(urn)\nif err != nil && strings.Contains(err.Error(), \"unknown resource\") { /* register or use getStackResourceOutputs */ }","preventionTips":["Only query URNs produced during the current update","Don't hardcode URNs; capture them from resource creation","Use cross-stack helpers for resources in other stacks"],"tags":["urn","builtin-provider","invoke"],"backgroundTag":"unknown-resource-urn","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}