{"record":{"id":"f42ab9b61ef9c1b6","repo":"siyuan-note/siyuan","slug":"errupdatepackageunavailable","errorCode":"errUpdatePackageUnavailable","errorMessage":"update package is unavailable","messagePattern":"update package is unavailable","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kernel/model/updater.go","lineNumber":59,"sourceCode":"\t\treturn \"\"\n\t}\n\n\tdownloadPkgURLs, checksum, err := getUpdatePkg()\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\tpkg := path.Base(downloadPkgURLs[0])\n\tpkgPath := filepath.Join(util.TempDir, \"install\", pkg)\n\tlocalChecksum, _ := sha256Hash(pkgPath)\n\tif checksum != localChecksum {\n\t\treturn \"\"\n\t}\n\treturn pkgPath\n}\n\nvar checkDownloadInstallPkgLock = sync.Mutex{}\nvar errUpdatePackageUnavailable = errors.New(\"update package is unavailable\")\n\nfunc checkDownloadInstallPkg(notifyPackageUnavailable bool) {\n\tdefer logging.Recover()\n\n\tif skipNewVerInstallPkg() {\n\t\treturn\n\t}\n\n\tif !checkDownloadInstallPkgLock.TryLock() {\n\t\treturn\n\t}\n\tdefer checkDownloadInstallPkgLock.Unlock()\n\n\tdownloadPkgURLs, checksum, err := getUpdatePkg()\n\tif err != nil {\n\t\tif notifyPackageUnavailable && errors.Is(err, errUpdatePackageUnavailable) {\n\t\t\tif release, releaseErr := getUpdateRelease(false); nil == releaseErr && !isVersionUpToDate(release.Version) {\n\t\t\t\tpushNewVersionNotification(release)","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/updater.go#L41-L77","documentation":"errUpdatePackageUnavailable is a sentinel in the model package's updater meaning no downloadable update install package could be resolved — either there is no package defined for the current platform or the release entry for the package is missing/has no URLs. checkDownloadInstallPkg and getUpdatePkg return it (often wrapped via %w) so callers can distinguish 'nothing to download' from transient network failures.","triggerScenarios":"Auto-update check (checkDownloadInstallPkg) or getNewVerInstallPkgPath on a platform for which the GitHub release publishes no install package, or where release.Packages has no entry/URLs for the computed package name.","commonSituations":"Running an unofficial build or a platform/arch the official release doesn't ship (e.g. unusual Linux distro packaging); a partially published release missing assets; CDN/GitHub asset URLs stripped or blocked.","solutions":["Verify a release asset matching your platform exists on the update server/GitHub release","Skip auto-download for unsupported platforms (set the appropriate skip option) and update manually from the release page","Check the updater's package-name mapping (currentInstallPackageName) covers your OS/arch","Match with errors.Is(err, errUpdatePackageUnavailable) to show 'package not available for your platform' rather than a generic network error"],"exampleFix":"// before\nif err := getUpdatePkg(); err != nil { notifyNetworkError() }\n// after\nif errors.Is(err, errUpdatePackageUnavailable) {\n    pushNewVersionNotification(release) // 提示手动下载\n} else if err != nil {\n    notifyNetworkError()\n}","handlingStrategy":"fallback","validationCode":"const supported = {win32: true, darwin: true, linux: true}; if (!supported[process.platform]) skipAutoUpdate()","typeGuard":"func isPkgUnavailable(err error) bool { return errors.Is(err, errUpdatePackageUnavailable) }","tryCatchPattern":"if err != nil {\n    if errors.Is(err, errUpdatePackageUnavailable) {\n        pushNewVersionNotification(release) // 手动下载提示\n        return\n    }\n    logging.LogErrorf(\"check update failed: %s\", err)\n}","preventionTips":["Confirm your platform/arch has a published release asset","Disable auto package download on unofficial builds","Always branch on the sentinel with errors.Is instead of string matching"],"tags":["go","updater","release-assets"],"backgroundTag":"resource-not-found","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}