{"record":{"id":"bd9722ac3d490776","repo":"kopia/kopia","slug":"unable-to-parse-object-id","errorCode":null,"errorMessage":"unable to parse object ID","messagePattern":"unable to parse object ID","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command_snapshot_pin.go","lineNumber":52,"sourceCode":"\t\tm, err := snapshot.LoadSnapshot(ctx, rep, manifest.ID(id))\n\t\tif err == nil {\n\t\t\tif err = c.pinSnapshot(ctx, rep, m); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"error pinning %v\", id)\n\t\t\t}\n\t\t} else if !errors.Is(err, snapshot.ErrSnapshotNotFound) {\n\t\t\treturn errors.Wrapf(err, \"error loading snapshot %v\", id)\n\t\t} else if err := c.pinSnapshotsByRootObjectID(ctx, rep, id); err != nil {\n\t\t\treturn errors.Wrapf(err, \"error pinning snapshots by root ID %v\", id)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (c *commandSnapshotPin) pinSnapshotsByRootObjectID(ctx context.Context, rep repo.RepositoryWriter, rootID string) error {\n\trootOID, err := object.ParseID(rootID)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to parse object ID\")\n\t}\n\n\tmanifests, err := snapshot.FindSnapshotsByRootObjectID(ctx, rep, rootOID)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"unable to find snapshots by root %v\", rootID)\n\t}\n\n\tif len(manifests) == 0 {\n\t\treturn errors.Errorf(\"no snapshots matched %v\", rootID)\n\t}\n\n\tfor _, m := range manifests {\n\t\tif err := c.pinSnapshot(ctx, rep, m); err != nil {\n\t\t\treturn errors.Wrap(err, \"error pinning\")\n\t\t}\n\t}\n\n\treturn nil","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/cli/command_snapshot_pin.go#L34-L70","documentation":"Returned when the string passed as a root ID to pinSnapshotsByRootObjectID cannot be parsed into a Kopia object ID via object.ParseID. Object IDs have a strict format (hex content hash, possibly with an encryption prefix), so any malformed or non-ID string fails here.","triggerScenarios":"`kopia snapshot pin` was given an ID that is not a snapshot manifest ID, so the code attempts to treat it as a root object ID and object.ParseID(rootID) fails — e.g. a manifest ID like 'k1234...', a path, or a name was passed.","commonSituations":"User passes a snapshot manifest ID (prefixed 'k') hoping to pin by root; passing a human-readable source path like '/home/user' instead of an ID; shell truncation of a copied ID.","solutions":["Pass a valid root object ID (hex content-hash format) when pinning by root.","Use `kopia snapshot list --json` to find snapshots and their rootObjectID values.","If you intended to pin a specific snapshot, use its full snapshot ID instead."],"exampleFix":"// before\nkopia snapshot pin /home/user\n// after\nkopia snapshot list --json | jq -r '.[].rootEntry.obj'  # get valid root OID\nkopia snapshot pin <rootObjectID>","handlingStrategy":"validation","validationCode":"// validate root object ID format before calling\nif _, err := object.ParseID(rootID); err != nil {\n    return fmt.Errorf(\"%q is not a valid object ID: %v\", rootID, err)\n}","typeGuard":null,"tryCatchPattern":"rootOID, err := object.ParseID(rootID)\nif err != nil {\n    return errors.Wrapf(err, \"unable to parse object ID %q\", rootID)\n}","preventionTips":["Only pass hex content-hash object IDs (not k-prefixed manifest IDs or paths) as root IDs","Source root IDs programmatically from `snapshot list --json` rootEntry.obj","Avoid hand-typing long IDs; copy-paste and verify length"],"tags":["cli","snapshot","object-id","parsing"],"backgroundTag":"invalid-identifier-format","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"}