AlistGo/alist · error
invalid line: %s, because file modified must be an unix time
Error message
invalid line: %s, because file modified must be an unix timestamp
What it means
The optional third metadata field of a url_tree line is a Unix timestamp (seconds). strconv.ParseInt over it failing — non-numeric, fractional like '2024-01-01', or float epoch — produces this error with the whole line echoed.
Source
Thrown at drivers/url_tree/util.go:133
return nil, fmt.Errorf("invalid line: %s, because file info must end with ':'", line)
}
info = info[:len(info)-1]
if info == "" {
return nil, fmt.Errorf("invalid line: %s, because file name can't be empty", line)
}
infoParts := strings.Split(info, ":")
node.Name = infoParts[0]
if len(infoParts) > 1 {
size, err := strconv.ParseInt(infoParts[1], 10, 64)
if err != nil {
return nil, fmt.Errorf("invalid line: %s, because file size must be an integer", line)
}
node.Size = size
haveSize = true
if len(infoParts) > 2 {
modified, err := strconv.ParseInt(infoParts[2], 10, 64)
if err != nil {
return nil, fmt.Errorf("invalid line: %s, because file modified must be an unix timestamp", line)
}
node.Modified = modified
}
}
} else {
node.Name = stdpath.Base(url)
}
if !haveSize && headSize {
size, err := getSizeFromUrl(url)
if err != nil {
log.Errorf("get size from url error: %s", err)
} else {
node.Size = size
}
}
return node, nil
}
View on GitHub (pinned to 843d9dc814)
Solutions
- Use integer Unix seconds: movie.mp4:1024:1700000000: https://x/m.mp4.
- Omit modified (Name:Size:URL) if not needed.
- Avoid ':' inside file names — it is the field separator.
Example fix
// before movie.mp4:1024:2024-01-01: https://x/m.mp4 // after movie.mp4:1024:1704153600: https://x/m.mp4
Defensive patterns
Strategy: validation
Validate before calling
func validateModifiedField(line string) error {
idx := strings.Index(line, "http")
if idx <= 0 { return nil }
parts := strings.Split(strings.TrimSuffix(line[:idx], ":"), ":")
if len(parts) > 2 && parts[2] != "" {
if _, err := strconv.ParseInt(parts[2], 10, 64); err != nil {
return fmt.Errorf("modified %q must be unix seconds", parts[2])
}
}
return nil
} Try / catch
if err != nil && strings.Contains(err.Error(), "must be an unix timestamp") { /* replace dates with epoch seconds */ } Prevention
- Use Unix epoch seconds, never ISO dates
- Keep field order Name:Size:Modified
- Avoid ':' in file names
When it happens
Trigger: Lines 'Name:Size:Modified:URL' where Modified is a date string ('2024-01-01'), an ISO timestamp, a float, or accidentally a URL fragment due to miscounted colons.
Common situations: Converting from human-readable listings, or misaligned colon fields where a name containing ':' shifts positions (e.g. 'a:b:1024:1700000000:URL' makes Modified parse '1700000000' but extra fields confuse earlier ones).
Related errors
- invalid line: %s, because file info must end with ':'
- invalid line: %s, because file name can't be empty
- invalid line: %s, because file size must be an integer
- no valid path mapping found
- failed to parse download_params: %w
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/69e5e20e9977b6d9.
Report an issue: GitHub.