siyuan-note/siyuan · error

update package URL or checksum is empty

Error message

update package URL or checksum is empty

What it means

downloadInstallPkg validates its inputs before doing any I/O: if the package URL or the expected checksum is an empty string it returns errors.New("update package URL or checksum is empty"). This is an internal pre-condition check ensuring a download is never attempted without the data needed to fetch and verify the package.

Solutions

  1. Ensure getUpdatePkg succeeded and returned non-empty URL/checksum before calling downloadInstallPkg
  2. Fix the update-server/release metadata so URLs and checksum are populated
  3. Add the same empty-string guard at your call site if you call downloadInstallPkg directly
  4. Log the release metadata when this fires to identify which field is missing

Example fix

// before
downloadInstallPkg(pkgURL, checksum)
// after
if "" == pkgURL || "" == checksum {
    return errors.New("skip download: missing url or checksum")
}
downloadInstallPkg(pkgURL, checksum)
Defensive patterns

Strategy: validation

Validate before calling

if "" == pkgURL || "" == checksum { return errors.New("skip download: missing url or checksum") }

Try / catch

if err := downloadInstallPkg(url, sum); err != nil {
    logging.LogErrorf("download aborted: %s", err)
    return err
}

Prevention

When it happens

Trigger: checkDownloadInstallPkg proceeds to downloadInstallPkg while the download URL list or checksum produced by getUpdatePkg is empty — i.e. an upstream guard was bypassed or a URL from pkg.URLs was blank.

Common situations: A malformed release whose URL entries are empty strings; a code path that skips the getUpdatePkg validation; custom update-server metadata missing URL or checksum fields.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/a714188cf71665f2. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/updater.go:138

		return
	}
	pkg := release.Packages[pkgName]
	if nil == pkg || 0 == len(pkg.URLs) {
		err = fmt.Errorf("%w: [%s]", errUpdatePackageUnavailable, pkgName)
		return
	}
	if "" == pkg.Checksum {
		err = fmt.Errorf("%w: [%s] checksum is unavailable", errUpdatePackageUnavailable, pkgName)
		return
	}
	downloadPkgURLs = append(downloadPkgURLs, pkg.URLs...)
	checksum = pkg.Checksum
	return
}

func downloadInstallPkg(pkgURL, checksum string) (err error) {
	if "" == pkgURL || "" == checksum {
		err = errors.New("update package URL or checksum is empty")
		return
	}

	pkg := path.Base(pkgURL)
	savePath := filepath.Join(util.TempDir, "install", pkg)
	if gulu.File.IsExist(savePath) {
		localChecksum, _ := sha256Hash(savePath)
		if localChecksum == checksum {
			return
		}
	}

	err = os.MkdirAll(filepath.Join(util.TempDir, "install"), 0755)
	if err != nil {
		logging.LogErrorf("create temp install dir failed: %s", err)
		return
	}

View on GitHub (pinned to 9f775e8a12)