You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[bug] Gitea sync fails with ERR_STREAM_PREMATURE_CLOSE, then crashes on null full_name #1404
allRepos=allRepos.filter((repo,index)=>{if(repo===null||repo===undefined){logger.warn(`Skipping null/undefined Gitea repo at index ${index}`);returnfalse;}returnrepo.full_name!==undefined;});
Picking this up. Root cause confirmed in packages/backend/src/gitea.ts: when repoGet fails mid-body (ERR_STREAM_PREMATURE_CLOSE) it resolves with { data: null, error } rather than throwing, and getRepos wraps that as data: [response.data] — pushing null into allRepos. The top-level allRepos.filter(repo => repo.full_name !== undefined) then dereferences null.full_name and crashes the whole sync. Fixing by treating a null response body as a per-repo warning (like the 404 path) so one failed fetch is skipped instead of failing the connection, and hardening the filter against null. Not attempting the underlying stream/Accept-Encoding workaround here — that's a separate networking concern.
Picking this up. Root cause confirmed in packages/backend/src/gitea.ts: when repoGet fails mid-body (ERR_STREAM_PREMATURE_CLOSE) it resolves with { data: null, error } rather than throwing, and getRepos wraps that as data: [response.data] — pushing null into allRepos. The top-level allRepos.filter(repo => repo.full_name !== undefined) then dereferences null.full_name and crashes the whole sync. Fixing by treating a null response body as a per-repo warning (like the 404 path) so one failed fetch is skipped instead of failing the connection, and hardening the filter against null. Not attempting the underlying stream/Accept-Encoding workaround here — that's a separate networking concern.
Hi Rachit,
Thank you for taking care of this problem. Please note, that the main issue is not a networking problem. The issue is related to the way the gittea client requests data from the server. The gittea client can't handle chunked server responses. You can reproduce the actual problem by running the gitea-server image I meantioned.
My suggested fix is to ask the server for a non-chuncked response by sending the ""Connection": "close"" - Header, like I meantioned in my patch.
Activity
rachit367 commentedon Jul 2, 2026
Picking this up. Root cause confirmed in
packages/backend/src/gitea.ts: whenrepoGetfails mid-body (ERR_STREAM_PREMATURE_CLOSE) it resolves with{ data: null, error }rather than throwing, andgetReposwraps that asdata: [response.data]— pushingnullintoallRepos. The top-levelallRepos.filter(repo => repo.full_name !== undefined)then dereferencesnull.full_nameand crashes the whole sync. Fixing by treating a null response body as a per-repo warning (like the 404 path) so one failed fetch is skipped instead of failing the connection, and hardening the filter against null. Not attempting the underlying stream/Accept-Encoding workaround here — that's a separate networking concern.HueskenNiels-hue commentedon Jul 3, 2026
Hi Rachit,
Thank you for taking care of this problem. Please note, that the main issue is not a networking problem. The issue is related to the way the gittea client requests data from the server. The gittea client can't handle chunked server responses. You can reproduce the actual problem by running the gitea-server image I meantioned.
My suggested fix is to ask the server for a non-chuncked response by sending the ""Connection": "close"" - Header, like I meantioned in my patch.
Kind Regards,
Niels
brendan-kellam commentedon Jul 8, 2026
@HueskenNiels-hue thanks for raising. I shipped a change in #1405. Can you let me know if this fixes your issue? thanks
HueskenNiels-hue commentedon Jul 8, 2026
@brendan-kellam Thanks for the quick response.
I checked against
Sync works flawless now. Thanks!