juicedata/juicefs · error

unexpected number of fields

Error message

unexpected number of fields

What it means

Returned by Config.parseHours when the upload-hours option does not split into exactly two numeric fields. The value must be like '1,5' or '1-5'; having fewer or more fields (or a trailing separator) makes the upload window ill-defined and is rejected.

Source

Thrown at pkg/chunk/cached_store.go:635

		c.CacheEviction = Eviction2Random
	}
	if c.CacheExpire > 0 && c.CacheExpire < time.Second {
		logger.Warnf("cache-expire it too short, setting it to 1 second")
		c.CacheExpire = time.Second
	}
}

func (c *Config) parseHours() (start, end int, err error) {
	if c.UploadHours == "" {
		return
	}
	split := ","
	if strings.Contains(c.UploadHours, "-") {
		split = "-"
	}
	ps := strings.Split(c.UploadHours, split)
	if len(ps) != 2 {
		err = errors.New("unexpected number of fields")
		return
	}
	if start, err = strconv.Atoi(ps[0]); err != nil {
		return
	}
	if end, err = strconv.Atoi(ps[1]); err != nil {
		return
	}
	if start < 0 || start > 23 || end < 0 || end > 23 {
		err = errors.New("invalid hour number")
	}
	return
}

func (c *Config) CacheEnabled() bool {
	return c.CacheSize > 0
}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Set upload-hours to exactly two hour values, e.g. --upload-hours 1,5 or --upload-hours 1-5
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/chunk/cached_store.go:635 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/b399e3faac403d15. Report an issue: GitHub.