juicedata/juicefs · error

parse name: %s

Error message

parse name: %s

What it means

Wraps a json.Decoder.Token() failure while readFiles/readEntry parse the top-level fields of a dumped metadata file in pkg/meta/dump.go. It means the JSON stream broke while reading the next key name, not that a value was invalid.

Source

Thrown at pkg/meta/dump.go:466

	dec := json.NewDecoder(r)
	if _, err = dec.Token(); err != nil {
		return
	}

	progress := utils.NewProgress(false)
	bar := progress.AddCountBar("Loaded entries", 1) // with root
	dm = &DumpedMeta{}
	counters = &DumpedCounters{ // rebuild counters
		NextInode: 2,
		NextChunk: 1,
	}
	parents = make(map[Ino][]Ino)
	refs = make(map[chunkKey]int64)
	var name json.Token
	for dec.More() {
		name, err = dec.Token()
		if err != nil {
			err = fmt.Errorf("parse name: %s", err)
			return
		}
		switch name {
		case "Setting":
			if err = dec.Decode(&dm.Setting); err == nil {
				_, err = json.MarshalIndent(dm.Setting, "", "")
			}
		case "Counters":
			if err = dec.Decode(&dm.Counters); err == nil {
				bar.SetTotal(dm.Counters.UsedInodes) // TODO
			}
		case "Sustained":
			err = dec.Decode(&dm.Sustained)
		case "DelFiles":
			err = dec.Decode(&dm.DelFiles)
		case "Quotas":
			err = dec.Decode(&dm.Quotas)
		case "UserQuotas":

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Re-dump the metadata with `juicefs dump` and load that complete file
  2. Validate the file is well-formed JSON (e.g. `python -m json.tool dump.json`) to locate the breakage
  3. Check the error wrapped after 'parse name:' for the exact JSON syntax problem
Defensive patterns

Strategy: validation

Validate before calling

// before load
f, _ := os.Open(dumpPath)
if err := json.NewDecoder(f).Token(); err != nil { return fmt.Errorf("not valid JSON: %w", err) }

Try / catch

if err := juicefsLoad(dumpFile); err != nil { if strings.Contains(err.Error(), "parse name") { /* file is truncated/invalid JSON: re-dump */ } }

Prevention

When it happens

Trigger: `juicefs load` on a dump file that is truncated mid-key, contains raw invalid JSON, or has binary corruption inside a field name.

Common situations: Interrupted dumps (partial file), corrupted transfer, editing a dump with a tool that re-encodes it incorrectly, loading a non-dump file by mistake.

Understand the failure class

Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.

Related errors


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