juicedata/juicefs · error

invalid changelog entry: %s

Error message

invalid changelog entry: %s

What it means

parseChangelogTime parses a changelog entry expected to start with '<unix-time>|'; if the entry contains no '|' separator, the entry is malformed and this error is returned. It guards changelog replay/parsing against corrupt or foreign entries.

Source

Thrown at pkg/meta/base.go:1088

				m.bgjobDuration.WithLabelValues("cleanupSlices", status).Observe(time.Since(jobStart).Seconds())
				m.bgjobDels.WithLabelValues("cleanupSlices").Add(float64(cnt))
			}()
		}
	}
}

func (m *baseMeta) CleanupSlices(ctx Context) syscall.Errno {
	return errno(m.en.doCleanupSlices(ctx, nil))
}

func (m *baseMeta) WaitDeleteSlices() {
	m.stopDeleteSliceTasks()
}

func parseChangelogTime(entry string) (time.Time, error) {
	idx := strings.IndexByte(entry, '|')
	if idx < 0 {
		return time.Time{}, fmt.Errorf("invalid changelog entry: %s", entry)
	}
	timePart := entry[:idx]
	dotIdx := strings.IndexByte(timePart, '.')
	if dotIdx < 0 {
		sec, err := strconv.ParseInt(timePart, 10, 64)
		if err != nil {
			return time.Time{}, err
		}
		return time.Unix(sec, 0), nil
	}
	sec, err := strconv.ParseInt(timePart[:dotIdx], 10, 64)
	if err != nil {
		return time.Time{}, err
	}
	nsec, err := strconv.ParseInt(timePart[dotIdx+1:], 10, 64)
	if err != nil {
		return time.Time{}, err
	}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Inspect the malformed entry and repair or remove it from the changelog
  2. Restore the changelog from a backup or snapshot and replay from a consistent point
  3. Check the writer path for corruption (disk full, truncation) before replaying again
Defensive patterns

Strategy: validation

Validate before calling

func validChangelogEntry(e string) bool { i := strings.IndexByte(e, '|'); return i > 0 && isDigits(e[:i]) }

Try / catch

if _, err := parseChangelogTime(entry); err != nil { log.Warnf("skipping malformed changelog entry: %v", err); continue }

Prevention

When it happens

Trigger: Replaying a changelog (e.g. during Redis AOF-based recovery or kv changelog processing) where an entry lost its timestamp prefix; manual edits or truncation of the changelog stream.

Common situations: Corrupted Redis AOF / changelog keys; entries written by incompatible tooling; partially rotated or hand-trimmed changelog logs.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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