dgraph-io/dgraph · error

readManifest failed to unmarshal:

Error message

readManifest failed to unmarshal: 

What it means

After successfully reading the manifest file bytes, readManifest unmarshals them as JSON. This error is thrown when the file content is not valid JSON for a Manifest struct — the file is corrupted, empty, truncated, or written by an incompatible format.

Source

Thrown at worker/backup_manifest.go:219

						op, err)
				}
				op.DropValue = ns_attr
			}
		}
	case 2105:
		// pass
	}
	return nil
}

func readManifest(h UriHandler, path string) (*Manifest, error) {
	var m Manifest
	b, err := h.Read(path)
	if err != nil {
		return &m, errors.Wrap(err, "readManifest failed to read the file: ")
	}
	if err := json.Unmarshal(b, &m); err != nil {
		return &m, errors.Wrap(err, "readManifest failed to unmarshal: ")
	}
	return &m, nil
}

func GetLatestManifest(h UriHandler, uri *url.URL) (*Manifest, error) {
	manifest, err := GetManifest(h, uri)
	if err != nil {
		return &Manifest{}, errors.Wrap(err, "failed to get the manifest: ")
	}
	if len(manifest.Manifests) == 0 {
		return &Manifest{}, nil
	}
	return manifest.Manifests[len(manifest.Manifests)-1], nil
}

func readMasterManifest(h UriHandler, path string) (*MasterManifest, error) {
	var m MasterManifest
	b, err := h.Read(path)

View on GitHub (pinned to 759e242be6)

Solutions

  1. Open the manifest file and check whether it is valid JSON; repair or replace it.
  2. Re-copy the manifest from the original backup source.
  3. Take a fresh backup into a new location.
  4. Fix any proxy/gateway that could serve error pages in place of file contents.

Example fix

// before: manifest truncated
{"version":1,"groups":
// after: restore full manifest file
aws s3 cp s3://original/backup/manifest-3 s3://bucket/backup/manifest-3
Defensive patterns

Strategy: validation

Validate before calling

b, _ := h.Read(path)
var probe map[string]interface{}
if err := json.Unmarshal(b, &probe); err != nil {
    return fmt.Errorf("manifest %s is not valid JSON: %v", path, err)
}

Type guard

func isValidManifestJSON(b []byte) bool {
    var m Manifest
    return json.Unmarshal(b, &m) == nil
}

Try / catch

if !isValidManifestJSON(b) {
    return fmt.Errorf("manifest corrupt, re-copy from source: %s", path)
}

Prevention

When it happens

Trigger: getConsolidatedManifest calls readManifest and json.Unmarshal(b, &m) fails — truncated upload, zero-byte manifest file, HTML error page saved as manifest (e.g. from a misconfigured proxy), or binary corruption.

Common situations: Interrupted backup upload leaving partial files; proxy returning HTML 403/503 bodies; disk corruption; user overwrote manifest file with other content.

Related errors


AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01). Data as JSON: /api/errors/ff12ae06d253ca8f. Report an issue: GitHub.