{"record":{"id":"18ad91023a6547ab","repo":"siyuan-note/siyuan","slug":"github-releases-are-empty","errorCode":null,"errorMessage":"GitHub releases are empty","messagePattern":"GitHub releases are empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/updater_release.go","lineNumber":252,"sourceCode":"func fetchGitHubReleases(ctx context.Context) ([]*githubRelease, error) {\n\treleases := []*githubRelease{}\n\trequest := httpclient.NewCloudRequest30s().\n\t\tSetContext(ctx).\n\t\tSetHeader(\"Accept\", \"application/vnd.github+json\").\n\t\tSetHeader(\"X-GitHub-Api-Version\", \"2022-11-28\").\n\t\tSetSuccessResult(&releases)\n\tresponse, err := request.Get(githubReleasesURL)\n\tif err != nil {\n\t\tlogging.LogErrorf(\"get GitHub releases failed: %s\", err)\n\t\treturn nil, err\n\t}\n\tif 200 != response.StatusCode {\n\t\terr = fmt.Errorf(\"get GitHub releases failed: %d\", response.StatusCode)\n\t\tlogging.LogError(err.Error())\n\t\treturn nil, err\n\t}\n\tif 0 == len(releases) {\n\t\treturn nil, errors.New(\"GitHub releases are empty\")\n\t}\n\n\tgithubReleasesLock.Lock()\n\tcachedGitHubReleases = releases\n\tgithubReleasesCacheTime = time.Now().Unix()\n\tgithubReleasesLock.Unlock()\n\treturn releases, nil\n}\n\nfunc selectGitHubRelease(releases []*githubRelease, channel string) *githubRelease {\n\tvar selected *githubRelease\n\tfor _, release := range releases {\n\t\tif nil == release || release.Draft || !isReleaseAllowed(channel, release.TagName) {\n\t\t\tcontinue\n\t\t}\n\t\tif nil == selected || 0 < semver.Compare(normalizeReleaseVersion(release.TagName), normalizeReleaseVersion(selected.TagName)) {\n\t\t\tselected = release\n\t\t}","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/updater_release.go#L234-L270","documentation":"After a 200 response from the GitHub releases API, fetchGitHubReleases checks that the decoded releases array is non-empty before populating the cache. If GitHub returns 200 with zero releases (empty array), the call fails with 'GitHub releases are empty' rather than proceeding with no selectable release.","triggerScenarios":"GET on the releases endpoint returning HTTP 200 with an empty JSON array — the repo has no published releases visible to the request, or the response body failed to unmarshal into releases leaving the slice empty.","commonSituations":"GitHub API outage/degraded mode returning empty payloads; a proxy or firewall stripping the response body; unexpected response shape (e.g. an error object) that SetSuccessResult cannot decode, silently yielding zero items.","solutions":["Retry the check later or with force=true once GitHub status (https://www.githubstatus.com) is healthy","Inspect https://api.github.com/repos/siyuan-note/siyuan/releases from the machine to see the raw body — if it is not a releases array, a proxy is altering the response","Use the stable channel instead, which does not depend on the GitHub releases API","Clear any interfering corporate proxy/DLP that rewrites GitHub API responses"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"resp, _ := http.Get(githubReleasesURL)\nbody, _ := io.ReadAll(resp.Body)\nvar arr []json.RawMessage\nlooksLikeArray := json.Unmarshal(body, &arr) == nil && len(arr) > 0","typeGuard":"func nonEmptyReleases(b []byte) bool {\n    var arr []*githubRelease\n    return json.Unmarshal(b, &arr) == nil && len(arr) > 0\n}","tryCatchPattern":"releases, err := fetchGitHubReleases(ctx)\nif err != nil {\n    if cachedGitHubReleases != nil { releases = cachedGitHubReleases } // last-known-good fallback\n}","preventionTips":["Verify GitHub status before debugging; empty 200 bodies occur during incidents","Check whether a proxy/DLP appliance strips or rewrites response bodies","Treat a persistent empty-array response as an upstream API problem, not a client bug","Keep the previous release list as a fallback for update decisions"],"tags":["github-api","empty-response","network"],"backgroundTag":"empty-result-set","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"}