{"record":{"id":"ed70d704d6f0d650","repo":"kopia/kopia","slug":"unique-id-not-found","errorCode":null,"errorMessage":"unique ID not found","messagePattern":"unique ID not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command_repository_sync.go","lineNumber":406,"sourceCode":"\n\tif uniqueID1 == uniqueID2 {\n\t\treturn nil\n\t}\n\n\treturn errors.New(\"destination repository contains incompatible data\")\n}\n\nfunc parseUniqueID(r gather.Bytes) (string, error) {\n\tvar f struct {\n\t\tUniqueID string `json:\"uniqueID\"`\n\t}\n\n\tif err := json.NewDecoder(r.Reader()).Decode(&f); err != nil {\n\t\treturn \"\", errors.Wrap(err, \"invalid JSON\")\n\t}\n\n\tif f.UniqueID == \"\" {\n\t\treturn \"\", errors.New(\"unique ID not found\")\n\t}\n\n\treturn f.UniqueID, nil\n}\n","sourceCodeStart":388,"sourceCodeEnd":411,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/cli/command_repository_sync.go#L388-L411","documentation":"parseUniqueID decodes a JSON document from a repository blob reader and extracts its UniqueID field. It throws this error when the JSON decodes successfully but the UniqueID field is empty, meaning the blob is not a valid unique-ID document that ensureRepositoriesHaveSameFormatBlob expects.","triggerScenarios":"ensureRepositoriesHaveSameFormatBlob reads a blob whose JSON parses but has an empty or missing uniqueID field; e.g. comparing two repositories where one's format blob was written by a version that does not embed a unique ID.","commonSituations":"Upgrading an old kopia repository whose format-blob JSON predates the UniqueID field; pointing --repository-format at a foreign or hand-edited format file; corrupted or truncated format blob contents.","solutions":["Verify the format blob JSON in the repository actually contains a non-empty uniqueID field","Re-create or repair the repository format (kopia repository repair / restore from backup) if the blob is corrupted","Ensure both repositories being synced were created by a kopia version that writes unique IDs","If comparing repos intentionally, skip the sync for repos lacking unique IDs instead of running repository sync"],"exampleFix":"// before\ntype formatBlob struct {\n    UniqueID string\n}\n// after - detect and surface the missing field\ntype formatBlob struct {\n    UniqueID string `json:\"uniqueID\"`\n}\nif f.UniqueID == \"\" {\n    return \"\", errors.Errorf(\"blob has no uniqueID (old format version?); upgrade the repository first\")\n}","handlingStrategy":"validation","validationCode":"var f struct{ UniqueID string `json:\"uniqueID\"` }\nif err := json.NewDecoder(r.Reader()).Decode(&f); err != nil { return err }\nif f.UniqueID == \"\" { return errors.New(\"blob JSON lacks uniqueID; upgrade repository format first\") }","typeGuard":"func hasUniqueID(f struct{ UniqueID string }) bool { return f.UniqueID != \"\" }","tryCatchPattern":null,"preventionTips":["Keep both repositories on kopia versions that write unique IDs","Validate format blob JSON after any manual repository manipulation","Back up the repository format before syncing or upgrading"],"tags":["json","repository","kopia"],"backgroundTag":"empty-required-field","analyzedSha":"82495e54b584c1ef6073c9e1be048f57f8aef078","analyzedAt":"2026-09-07T20:35:21.689Z","contentChangedAt":"2026-09-07T20:35:21.689Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}