AlistGo/alist · error
addr is nil
Error message
addr is nil
What it means
getRawFiles dereferences a *pubUserFile.SliceDownloadInfo describing where to fetch slice bytes; a nil pointer means the caller passed no download address at all. Guarding prevents a panic at addr.DownloadAddress. It fires before the 60-second http.Client GET, so no network I/O has happened.
Source
Thrown at drivers/halalcloud/util.go:223
}
return opPath
}
func (d *HalalCloud) GetCurrentDir(dir model.Obj) string {
currentDir := dir.GetPath()
if len(currentDir) == 0 {
currentDir = "/"
}
return currentDir
}
type Common struct {
}
func getRawFiles(addr *pubUserFile.SliceDownloadInfo) ([]byte, error) {
if addr == nil {
return nil, errors.New("addr is nil")
}
client := http.Client{
Timeout: time.Duration(60 * time.Second), // Set timeout to 5 seconds
}
resp, err := client.Get(addr.DownloadAddress)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("bad status: %s, body: %s", resp.Status, body)
}View on GitHub (pinned to 843d9dc814)
Solutions
- In the caller, verify the SliceDownloadInfo field is non-nil (and DownloadAddress non-empty) before invoking getRawFiles
- If nil because the file is processing, wait/retry until the server populates download info
- Capture the raw gRPC response for the failing file to confirm whether download info was ever sent
Example fix
// before
info := resp.File.SliceDownloadInfo
raw, err := getRawFiles(info)
// after
if resp.File == nil || resp.File.SliceDownloadInfo == nil {
return fmt.Errorf("file %s has no download info yet", name)
}
raw, err := getRawFiles(resp.File.SliceDownloadInfo) Defensive patterns
Strategy: type-guard
Validate before calling
if info == nil || strings.TrimSpace(info.DownloadAddress) == "" {
return fmt.Errorf("slice download info unavailable for this file; retry after processing completes")
} Type guard
func hasDownloadInfo(info *pubUserFile.SliceDownloadInfo) bool {
return info != nil && strings.TrimSpace(info.DownloadAddress) != ""
} Prevention
- Check server metadata fields for nil before every dereference in driver adapters
- Treat missing download info on a fresh upload as 'processing', not an error: retry with backoff
When it happens
Trigger: HalalCloud list/download path hands a nil SliceDownloadInfo to getRawFiles — typically the file metadata from the gRPC response had no download info populated (file still processing, server returned nil field) or a lookup returned nil and was passed unchecked.
Common situations: Downloading a just-uploaded file whose slices are not ready server-side; server-side outage returning incomplete metadata; code path assumes addr is always present after a range/list call that actually returned an error the caller ignored.
Related errors
- missing cookie or qrcode account
- server returns no url
- empty download url
- cannot download a submodule
- empty download url
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/ecaadf3758cf0265.
Report an issue: GitHub.