goharbor/harbor · error
empty cron string is invalid
Error message
empty cron string is invalid
What it means
Error "empty cron string is invalid" thrown in goharbor/harbor.
Source
Thrown at src/common/utils/utils.go:302
}
cr := strings.TrimSpace(cron)
s, err := CronParser().Parse(cr)
if err != nil {
log.Debugf("the cron string %v is invalid, error: %v", cron, err)
return time.Time{}
}
return s.Next(curTime)
}
// CronParser returns the parser of cron string with format of "* * * * * *"
func CronParser() cronlib.Parser {
return cronlib.NewParser(cronlib.Second | cronlib.Minute | cronlib.Hour | cronlib.Dom | cronlib.Month | cronlib.Dow)
}
// ValidateCronString check whether it is a valid cron string and whether the 1st field (indicating Seconds of time) of the cron string is a fixed value of 0 or not
func ValidateCronString(cron string) error {
if len(cron) == 0 {
return fmt.Errorf("empty cron string is invalid")
}
_, err := CronParser().Parse(cron)
if err != nil {
return err
}
cronParts := strings.Split(cron, " ")
if len(cronParts) == 6 && cronParts[0] != "0" {
return fmt.Errorf("the 1st field (indicating Seconds of time) of the cron setting must be 0")
}
return nil
}
// IsLocalPath checks if path is local, includes the empty path
func IsLocalPath(path string) bool {
return len(path) == 0 || (strings.HasPrefix(path, "/") && !strings.HasPrefix(path, "//"))
}
View on GitHub (pinned to 7b2fd08cc5)
When it happens
Trigger: Thrown at src/common/utils/utils.go:302 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16).
Data as JSON: /api/errors/1901ecc295ad1b32.
Report an issue: GitHub.