{"record":{"id":"9051ecbaad06a4f0","repo":"anomalyco/sst","slug":"not-found","errorCode":null,"errorMessage":"not found","messagePattern":"not found","errorType":"error_code","errorClass":"ErrNotFound","httpStatus":null,"severity":"error","filePath":"sdk/golang/resource/resource.go","lineNumber":65,"sourceCode":"\n\t// In Go, we pass the auth tag as part of the ciphertext\n\tciphertextWithTag := append(actualCiphertext, authTag...)\n\n\t// Decrypt\n\tdecrypted, err := aesGCM.Open(nil, nonce, ciphertextWithTag, nil)\n\tif err != nil {\n\t\tresources = make(map[string]any)\n\t\treturn\n\t}\n\n\t// Parse JSON\n\tif err := json.Unmarshal(decrypted, &resources); err != nil {\n\t\tresources = make(map[string]any)\n\t\treturn\n\t}\n}\n\nvar ErrNotFound = errors.New(\"not found\")\n\nfunc Get(path ...string) (any, error) {\n\treturn get(resources, path...)\n}\n\nfunc All() map[string]any {\n\treturn resources\n}\n\nfunc get(input any, path ...string) (any, error) {\n\tif len(path) == 0 {\n\t\treturn input, nil\n\t}\n\tcasted, ok := input.(map[string]any)\n\tif !ok {\n\t\treturn nil, ErrNotFound\n\t}\n\tnext, ok := casted[path[0]]","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/sdk/golang/resource/resource.go#L47-L83","documentation":"The Go runtime SDK's Get() walks the linked-resource tree and returns ErrNotFound (a sentinel from errors.New) when the requested path does not exist in the resources map loaded from the encrypted resource payload. It signals that either no resources were linked to this function or the path segments are wrong.","triggerScenarios":"Calling sdk.Get(\"Bucket\", \"arn\") where the resource name or property key is misspelled, or calling Get before resources finish loading (e.g. during cold start in a non-SST runtime), or when no resource is linked via sst.Linkable/links.","commonSituations":"Renaming a resource in sst.config.ts but not in the function code; typos in property paths like 'bucketName' vs 'name'; forgetting to add the resource to the function's links; running the handler outside `sst dev` so the resource file is absent (resources stays an empty map).","solutions":["Verify the resource is passed in the function's `link: [...]` array in sst.config.ts and redeploy","Print all available keys with sdk.All() and correct the path segments","Check the exact property name exposed by the resource (e.g. use Resource.Bucket.name)","Ensure the function runs via sst dev / deployed with SST so the resource metadata file exists"],"exampleFix":"// before\nbucketArn := sdk.Get(\"MyBucket\").(map[string]any)[\"arn\"]\n// after\nval, err := sdk.Get(\"MyBucket\", \"arn\")\nif errors.Is(err, sdk.ErrNotFound) {\n    log.Fatalf(\"MyBucket not linked: %v\", sdk.All())\n}","handlingStrategy":"try-catch","validationCode":"if avail := sdk.All(); len(avail) == 0 {\n    return fmt.Errorf(\"no resources linked to this function\")\n}","typeGuard":"func resourceExists(path ...string) bool {\n    _, err := sdk.Get(path...)\n    return !errors.Is(err, sdk.ErrNotFound)\n}","tryCatchPattern":"val, err := sdk.Get(\"MyBucket\", \"arn\")\nif err != nil {\n    if errors.Is(err, sdk.ErrNotFound) {\n        // handle missing link: log available keys and fail fast\n    }\n    return err\n}","preventionTips":["Always add resources to the function's link array in sst.config.ts","Use sdk.All() during development to confirm available resource keys","Keep resource names in a shared constants file used by both config and function code"],"tags":["go","sdk","resource-lookup"],"backgroundTag":"resource-not-linked","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}