{"record":{"id":"c1663d8e83e0c36e","repo":"hashicorp/terraform","slug":"failed-to-compute-checksum-for-s-s","errorCode":null,"errorMessage":"failed to compute checksum for %s: %s","messagePattern":"failed to compute checksum for (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/getproviders/package_authentication.go","lineNumber":311,"sourceCode":"//\n// NewPackageHashAuthentication is preferable to use when possible because\n// it uses the newer hashing scheme (implemented by function PackageHash) that\n// can work with both packed and unpacked provider packages.\nfunc NewArchiveChecksumAuthentication(platform Platform, wantSHA256Sum [sha256.Size]byte) PackageAuthentication {\n\treturn archiveHashAuthentication{platform, wantSHA256Sum}\n}\n\nfunc (a archiveHashAuthentication) AuthenticatePackage(localLocation PackageLocation) (*PackageAuthenticationResult, error) {\n\tarchiveLocation, ok := localLocation.(PackageLocalArchive)\n\tif !ok {\n\t\t// A source should not use this authentication type for non-archive\n\t\t// locations.\n\t\treturn nil, fmt.Errorf(\"cannot check archive hash for non-archive location %s\", localLocation)\n\t}\n\n\tgotHash, err := PackageHashLegacyZipSHA(archiveLocation)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to compute checksum for %s: %s\", archiveLocation, err)\n\t}\n\twantHash := HashLegacyZipSHAFromSHA(a.WantSHA256Sum)\n\tif gotHash != wantHash {\n\t\treturn nil, fmt.Errorf(\"archive has incorrect checksum %s (expected %s)\", gotHash, wantHash)\n\t}\n\treturn &PackageAuthenticationResult{result: verifiedChecksum}, nil\n}\n\nfunc (a archiveHashAuthentication) AcceptableHashes() []Hash {\n\treturn []Hash{HashLegacyZipSHAFromSHA(a.WantSHA256Sum)}\n}\n\ntype matchingChecksumAuthentication struct {\n\tDocument      []byte\n\tFilename      string\n\tWantSHA256Sum [sha256.Size]byte\n}\n","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/getproviders/package_authentication.go#L293-L329","documentation":"Wrapper from archiveHashAuthentication.AuthenticatePackage when PackageHashLegacyZipSHA cannot hash the archive. The inner '%s' is the I/O cause from EvalSymlinks, os.Open, or io.Copy over the archive file. The '%s' before it is the archive location path.","triggerScenarios":"PackageHashLegacyZipSHA(archiveLocation) at line 309 returns an error: filepath.EvalSymlinks fails (dangling symlink), os.Open fails (ENOENT/EACCES), or io.Copy fails (read error on the zip).","commonSituations":"The staged .zip was deleted or moved between download and verification. Permissions on the cache dir prevent reading. The archive is on a network mount that dropped. A broken symlink in the plugin cache path.","solutions":["Re-stage the provider: remove the cached archive and run 'terraform init' again.","Read the inner error and fix the underlying I/O problem (chmod, free space, fix symlinks).","Move the plugin cache off a flaky network filesystem onto local disk."],"exampleFix":"// before\n$ terraform init\nError: failed to compute checksum for .terraform/.../zip: open ...: permission denied\n// after\n$ chmod -R u+rwX .terraform/providers && terraform init","handlingStrategy":"retry","validationCode":"// Verify the archive is openable before authenticating.\nif _, err := os.Stat(string(archiveLoc)); err != nil { return err }\nf, err := os.Open(string(archiveLoc)); if err != nil { return err }; f.Close()","typeGuard":null,"tryCatchPattern":"// I/O failure computing the hash is usually transient; re-stage once.\n_, err := auth.AuthenticatePackage(loc)\nif err != nil && strings.Contains(err.Error(), \"failed to compute checksum\") {\n    _ = restageArchive(); _, err = auth.AuthenticatePackage(loc)\n}\nreturn err","preventionTips":["Do not unpack or delete the .zip until after archive authentication.","Keep cache dir permissions permissive for the running user.","Avoid symlink chains that can dangle during verification."],"tags":["io","archive","checksum","filesystem","cache"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}