{"record":{"id":"976146fec085f412","repo":"hashicorp/terraform","slug":"there-is-no-package-for-s-s-cached-in-s","errorCode":null,"errorMessage":"there is no package for %s %s cached in %s","messagePattern":"there is no package for (.+?) (.+?) cached in (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/meta_providers.go","lineNumber":402,"sourceCode":"\t\treportError := func(thisErr error) {\n\t\t\terrs[provider] = thisErr\n\t\t\t// We'll populate a provider factory that just echoes our error\n\t\t\t// again if called, which allows us to still report a helpful\n\t\t\t// error even if it gets detected downstream somewhere from the\n\t\t\t// caller using our partial result.\n\t\t\tfactories[provider] = providerFactoryError(thisErr)\n\t\t}\n\n\t\tif locks.ProviderIsOverridden(provider) {\n\t\t\t// Overridden providers we'll handle with the other separate\n\t\t\t// loops below, for dev overrides etc.\n\t\t\tcontinue\n\t\t}\n\n\t\tversion := lock.Version()\n\t\tcached := cacheDir.ProviderVersion(provider, version)\n\t\tif cached == nil {\n\t\t\treportError(fmt.Errorf(\n\t\t\t\t\"there is no package for %s %s cached in %s\",\n\t\t\t\tprovider, version, cacheDir.BasePath(),\n\t\t\t))\n\t\t\tcontinue\n\t\t}\n\t\t// The cached package must match one of the checksums recorded in\n\t\t// the lock file, if any.\n\t\tif allowedHashes := lock.PreferredHashes(); len(allowedHashes) != 0 {\n\t\t\tmatched, err := cached.MatchesAnyHash(allowedHashes)\n\t\t\tif err != nil {\n\t\t\t\treportError(fmt.Errorf(\n\t\t\t\t\t\"failed to verify checksum of %s %s package cached in in %s: %s\",\n\t\t\t\t\tprovider, version, cacheDir.BasePath(), err,\n\t\t\t\t))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !matched {\n\t\t\t\treportError(fmt.Errorf(","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/meta_providers.go#L384-L420","documentation":"Raised when a provider version recorded in the lock file is not present in the local plugin cache directory (.terraform/providers). cacheDir.ProviderVersion(provider, version) returned nil, meaning the expected package is missing — typically because init was not run, was interrupted, the cache was cleared, or TF_PLUGIN_CACHE_DIR changed.","triggerScenarios":"providerFactoriesFromLocks: for a locked provider, cacheDir.ProviderVersion(provider, version)==nil. Triggered after deleting .terraform/providers, switching TF_PLUGIN_CACHE_DIR, copying a config without its .terraform cache, or a partial/failed init.","commonSituations":"Cloning a repo without running init; manually rm -rf .terraform; CI cache miss; switching the data dir (TF_DATA_DIR); a previous init was interrupted before all providers downloaded.","solutions":["Run `terraform init` to download the locked provider versions into the cache.","If TF_PLUGIN_CACHE_DIR is set, ensure that directory is populated or let init populate it.","Verify TF_DATA_DIR points to the same cache used during init.","Do not manually delete .terraform/providers; re-run init if you must."],"exampleFix":"// before\n// terraform plan -> there is no package for registry.terraform.io/hashicorp/aws 4.0 cached in .terraform/providers\n\n// after\nterraform init   # populates .terraform/providers from the lock file","handlingStrategy":"validation","validationCode":"// Ensure providers are cached before plan/apply\nfunc providersCached(lockPath, cacheDir string) (bool, error) {\n    locks, err := depsfile.LoadLocksFromFile(lockPath)\n    if err != nil { return false, err }\n    for p, l := range locks.AllProviders() {\n        if _, err := os.Stat(filepath.Join(cacheDir, p.String(), l.Version().String())); err != nil {\n            return false, nil\n        }\n    }\n    return true, nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run `terraform init` before plan/apply to populate the cache.","Do not delete .terraform/providers manually; re-run init instead.","Keep TF_DATA_DIR and TF_PLUGIN_CACHE_DIR consistent across runs.","After cloning a repo, run init before any other terraform command."],"tags":["terraform","providers","cache","lock-file","init"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}