{"record":{"id":"ff12ae06d253ca8f","repo":"dgraph-io/dgraph","slug":"readmanifest-failed-to-unmarshal","errorCode":null,"errorMessage":"readManifest failed to unmarshal: ","messagePattern":"readManifest failed to unmarshal: ","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"worker/backup_manifest.go","lineNumber":219,"sourceCode":"\t\t\t\t\t\top, err)\n\t\t\t\t}\n\t\t\t\top.DropValue = ns_attr\n\t\t\t}\n\t\t}\n\tcase 2105:\n\t\t// pass\n\t}\n\treturn nil\n}\n\nfunc readManifest(h UriHandler, path string) (*Manifest, error) {\n\tvar m Manifest\n\tb, err := h.Read(path)\n\tif err != nil {\n\t\treturn &m, errors.Wrap(err, \"readManifest failed to read the file: \")\n\t}\n\tif err := json.Unmarshal(b, &m); err != nil {\n\t\treturn &m, errors.Wrap(err, \"readManifest failed to unmarshal: \")\n\t}\n\treturn &m, nil\n}\n\nfunc GetLatestManifest(h UriHandler, uri *url.URL) (*Manifest, error) {\n\tmanifest, err := GetManifest(h, uri)\n\tif err != nil {\n\t\treturn &Manifest{}, errors.Wrap(err, \"failed to get the manifest: \")\n\t}\n\tif len(manifest.Manifests) == 0 {\n\t\treturn &Manifest{}, nil\n\t}\n\treturn manifest.Manifests[len(manifest.Manifests)-1], nil\n}\n\nfunc readMasterManifest(h UriHandler, path string) (*MasterManifest, error) {\n\tvar m MasterManifest\n\tb, err := h.Read(path)","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/backup_manifest.go#L201-L237","documentation":"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.","triggerScenarios":"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.","commonSituations":"Interrupted backup upload leaving partial files; proxy returning HTML 403/503 bodies; disk corruption; user overwrote manifest file with other content.","solutions":["Open the manifest file and check whether it is valid JSON; repair or replace it.","Re-copy the manifest from the original backup source.","Take a fresh backup into a new location.","Fix any proxy/gateway that could serve error pages in place of file contents."],"exampleFix":"// before: manifest truncated\n{\"version\":1,\"groups\":\n// after: restore full manifest file\naws s3 cp s3://original/backup/manifest-3 s3://bucket/backup/manifest-3","handlingStrategy":"validation","validationCode":"b, _ := h.Read(path)\nvar probe map[string]interface{}\nif err := json.Unmarshal(b, &probe); err != nil {\n    return fmt.Errorf(\"manifest %s is not valid JSON: %v\", path, err)\n}","typeGuard":"func isValidManifestJSON(b []byte) bool {\n    var m Manifest\n    return json.Unmarshal(b, &m) == nil\n}","tryCatchPattern":"if !isValidManifestJSON(b) {\n    return fmt.Errorf(\"manifest corrupt, re-copy from source: %s\", path)\n}","preventionTips":["Verify backup uploads completed (size/checksum) before use","Detect proxies that return HTML error bodies instead of file contents","Restore manifests from the original source if corruption is found"],"tags":["backup","manifest","json","corruption"],"backgroundTag":"manifest-json-unmarshal-failed","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}