{"record":{"id":"24b01e44120b19bd","repo":"AlistGo/alist","slug":"upload-download-stream-incomplete-possible-networ","errorCode":null,"errorMessage":"upload/download stream incomplete, possible network issue","messagePattern":"upload/download stream incomplete, possible network issue","errorType":"exception","errorClass":"StreamIncomplete","httpStatus":null,"severity":"error","filePath":"internal/errs/errors.go","lineNumber":20,"sourceCode":"\nimport (\n\t\"errors\"\n\t\"fmt\"\n\n\tpkgerr \"github.com/pkg/errors\"\n)\n\nvar (\n\tNotImplement = errors.New(\"not implement\")\n\tNotSupport   = errors.New(\"not support\")\n\tRelativePath = errors.New(\"access using relative path is not allowed\")\n\n\tMoveBetweenTwoStorages = errors.New(\"can't move files between two storages, try to copy\")\n\tUploadNotSupported     = errors.New(\"upload not supported\")\n\n\tMetaNotFound     = errors.New(\"meta not found\")\n\tStorageNotFound  = errors.New(\"storage not found\")\n\tStreamIncomplete = errors.New(\"upload/download stream incomplete, possible network issue\")\n\tStreamPeekFail   = errors.New(\"StreamPeekFail\")\n\n\tUnknownArchiveFormat      = errors.New(\"unknown archive format\")\n\tWrongArchivePassword      = errors.New(\"wrong archive password\")\n\tDriverExtractNotSupported = errors.New(\"driver extraction not supported\")\n)\n\n// NewErr wrap constant error with an extra message\n// use errors.Is(err1, StorageNotFound) to check if err belongs to any internal error\nfunc NewErr(err error, format string, a ...any) error {\n\treturn fmt.Errorf(\"%w; %s\", err, fmt.Sprintf(format, a...))\n}\n\nfunc IsNotFoundError(err error) bool {\n\treturn errors.Is(pkgerr.Cause(err), ObjectNotFound) || errors.Is(pkgerr.Cause(err), StorageNotFound)\n}\n\nfunc IsNotSupportError(err error) bool {","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/internal/errs/errors.go#L2-L38","documentation":"StreamIncomplete signals that a transfer stream ended prematurely — bytes actually read or written did not match the expected size, or a cloud API reported an incomplete upload. It is defined in internal/errs/errors.go and wrapped via errs.NewErr by drivers such as baidu_netdisk and baidu_youth when they verify response bodies or uploaded file sizes.","triggerScenarios":"Baidu netdisk driver getting a truncated/invalid response body during upload (drivers/baidu_netdisk/driver.go:454); baidu_youth detecting temp-file size mismatch between bytes written and the stream's declared size (drivers/baidu_youth/driver.go:287); baidu_youth util receiving a short error body (drivers/baidu_youth/util.go:572). In general, dropped connections mid-copy between AList and the remote storage.","commonSituations":"Unstable network or proxy timeouts on large uploads; remote provider throttling or resetting connections; disk full so the temp file is truncated; copy/move between two storages where the download side stalls. Transient — usually resolves on retry.","solutions":["Retry the transfer (typically a transient network condition)","Check network stability, proxy/CDN timeouts, and rate limits on the cloud provider","Verify local disk space for TempDir when large uploads stage through temp files","If persistent for one provider, re-authorize the storage — expired tokens sometimes produce HTML error pages that parse as truncated bodies"],"exampleFix":"// before\nerr := fs.Copy(ctx, src, dst, nil)\n\n// after\nerr := fs.Copy(ctx, src, dst, nil)\nif err != nil && errors.Is(errors.Cause(err), errs.StreamIncomplete) {\n    // safe to retry the copy; remove partial destination first\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":"func isStreamIncomplete(err error) bool {\n    return err != nil && errors.Is(errors.Cause(err), errs.StreamIncomplete)\n}","tryCatchPattern":"err := fs.Copy(ctx, src, dst, nil)\nif isStreamIncomplete(err) {\n    backoff.Retry(cleanPartialAndCopy, 3) // remove partial dst, then retry\n}","preventionTips":["Wrap transfers with bounded retry + exponential backoff","Monitor temp-dir free space","Keep provider auth fresh — expired tokens yield HTML bodies parsed as truncation","Retry only after cleaning partial destination files"],"tags":["network","upload","download","retryable"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}