kopia/kopia · error

unable to parse

Error message

unable to parse %q

What it means

Wraps a failure from snapshotfs.ParseObjectIDWithPath when a user-supplied object ID/path argument (verifyCommandFileObjectIDs) cannot be resolved against the repository root. The parse fails because the string is not a valid object ID, an existing path in the snapshot tree, or a resolvable shorthand. The wrapper preserves the underlying parse error and adds the offending argument in %q for diagnosis.

Solutions

  1. Check the exact object ID/path string for typos, truncation, or extra whitespace and re-run.
  2. Verify the ID exists in this repository via `kopia show <oid>` or `kopia blob list` before passing it.
  3. List valid objects with `kopia snapshot verify --file-...` on IDs taken from `kopia snapshot list --all` output.
  4. If the object was pruned, re-create or restore it from a snapshot before verifying.

Example fix

// before
kopia snapshot verify --file-object-ids=kABcd123   // truncated OID
// after
kopia snapshot verify --file-object-ids=kABcd1234567890abcdef...  // full valid OID from kopia show
Defensive patterns

Strategy: validation

Validate before calling

oid := strings.TrimSpace(arg)
if len(oid) == 0 || strings.ContainsAny(oid, " \t") {
    return fmt.Errorf("invalid object ID argument: %q", oid)
}
// pre-check resolvability if you have a repo handle
if _, err := snapshotfs.ParseObjectIDWithPath(ctx, rep, oid); err != nil {
    return fmt.Errorf("object ID %q not resolvable in this repo: %w", oid, err)
}

Try / catch

if _, err := snapshotfs.ParseObjectIDWithPath(ctx, rep, oidStr); err != nil {
    var parseErr *snapshotfs.ParseError
    if errors.As(err, &parseErr) { /* handle unresolvable ID */ }
    return errors.Wrapf(err, "unable to parse %q", oidStr)
}

Prevention

When it happens

Trigger: Running `kopia snapshot verify` with --file-object-ids (or similar) containing a malformed OID (wrong length/characters), a path that does not exist under the repo root, or an ID pointing at a deleted/never-existing object.

Common situations: Typoed or truncated object ID pasted from logs; referencing an object from a different repository; path casing mismatch; object GC'd or repository pruned since the ID was recorded.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of kopia/kopia@82495e54b5 (2026-09-07). Data as JSON: /api/errors/5f24d87fc4b533af. Report an issue: GitHub.

Appendix: source

Thrown at cli/command_snapshot_verify.go:164

			//nolint:errcheck
			tw.Process(ctx, twEntry.root, twEntry.rootPath)
		}

		for _, oidStr := range c.verifyCommandDirObjectIDs {
			oid, err := snapshotfs.ParseObjectIDWithPath(ctx, rep, oidStr)
			if err != nil {
				return errors.Wrapf(err, "unable to parse: %q", oidStr)
			}

			// ignore error now, return aggregate error at a higher level.
			//nolint:errcheck
			tw.Process(ctx, snapshotfs.DirectoryEntry(rep, oid, nil), oidStr)
		}

		for _, oidStr := range c.verifyCommandFileObjectIDs {
			oid, err := snapshotfs.ParseObjectIDWithPath(ctx, rep, oidStr)
			if err != nil {
				return errors.Wrapf(err, "unable to parse %q", oidStr)
			}

			// ignore error now, return aggregate error at a higher level.
			//nolint:errcheck
			tw.Process(ctx, snapshotfs.AutoDetectEntryFromObjectID(ctx, rep, oid, oidStr), oidStr)
		}

		return nil
	}
}

// addExpectedWorkFromDirSummaryToVerifier initializes the snapshot verifier with an
// expected amount of work that will take place during the tree walk for this Entry.
// If the entry is not a DirectoryWithSummary, or the Summary returns nil, no stats
// will be added to the totals.
func addExpectedWorkFromDirSummaryToVerifier(ctx context.Context, v *snapshotfs.Verifier, ent fs.Entry) error {
	dws, ok := ent.(fs.DirectoryWithSummary)
	if !ok {

View on GitHub (pinned to 82495e54b5)