kopia/kopia · error

entry snapshotted detail

Error message

entry snapshotted detail

What it means

Wrapper error from kopia's `policy set` for the `--log-entry-snapshotted` flag. It wraps a parse failure inside applyPolicyLogDetailPtr: the given value could not be converted to a valid policy.LogDetail integer or the 'inherit' keyword.

Solutions

  1. Supply a plain integer within the documented LogDetail range, e.g. `--log-entry-snapshotted 1`.
  2. Use 'inherit' (no quotes needed beyond shell quoting) to reset to the inherited default.
  3. Trim whitespace/quotes from the value in scripts before invoking kopia.

Example fix

// before
kopia policy set /path --log-entry-snapshotted 99
// after
kopia policy set /path --log-entry-snapshotted 2
Defensive patterns

Strategy: validation

Validate before calling

func validateLogDetailFlag(name, value string) error {
    if value == "" || value == "inherit" {
        return nil
    }
    v, err := strconv.Atoi(value)
    if err != nil || v < int(policy.LogDetailNone) || v > int(policy.LogDetailMax) {
        return fmt.Errorf("%s must be an integer in [%d,%d] or 'inherit', got %q", name, policy.LogDetailNone, policy.LogDetailMax, value)
    }
    return nil
}

Try / catch

err := c.setLoggingPolicyFromFlags(ctx, p, &n)
if err != nil {
    var synErr *strconv.NumError
    if errors.As(err, &synErr) {
        return fmt.Errorf("log detail flags require an integer or 'inherit'")
    }
    return err
}

Prevention

When it happens

Trigger: `kopia policy set ... --log-entry-snapshotted <value>` with a non-integer or out-of-range value (must be >= LogDetailNone and <= LogDetailMax, or 'inherit').

Common situations: Hand-editing shell scripts with a mistyped level; passing floats like '1.5'; passing boolean-style 'on'; using a level valid for a different kopia version after an upgrade changed the enum bounds.

Understand the failure class

Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.

Related errors


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

Appendix: source

Thrown at cli/command_policy_set_logging.go:41

	cmd.Flag("log-dir-snapshotted", "Log detail when a directory is snapshotted (or 'inherit')").PlaceHolder("N").StringVar(&c.dirSnapshottedDetail)
	cmd.Flag("log-dir-ignored", "Log detail when a directory is ignored (or 'inherit')").PlaceHolder("N").StringVar(&c.dirIgnoredDetail)
	cmd.Flag("log-entry-snapshotted", "Log detail when an entry is snapshotted (or 'inherit')").PlaceHolder("N").StringVar(&c.entrySnapshottedDetail)
	cmd.Flag("log-entry-ignored", "Log detail when an entry is ignored (or 'inherit')").PlaceHolder("N").StringVar(&c.entryIgnoredDetail)
	cmd.Flag("log-entry-cache-hit", "Log detail on entry cache hit (or 'inherit')").PlaceHolder("N").StringVar(&c.entryCacheHitDetail)
	cmd.Flag("log-entry-cache-miss", "Log detail on entry cache miss (or 'inherit')").PlaceHolder("N").StringVar(&c.entryCacheMissDetail)
}

func (c *policyLoggingFlags) setLoggingPolicyFromFlags(ctx context.Context, p *policy.LoggingPolicy, changeCount *int) error {
	if err := applyPolicyLogDetailPtr(ctx, "directory snapshotted detail", &p.Directories.Snapshotted, c.dirSnapshottedDetail, changeCount); err != nil {
		return errors.Wrap(err, "directory snapshotted detail")
	}

	if err := applyPolicyLogDetailPtr(ctx, "directory ignored detail", &p.Directories.Ignored, c.dirIgnoredDetail, changeCount); err != nil {
		return errors.Wrap(err, "directory ignored detail")
	}

	if err := applyPolicyLogDetailPtr(ctx, "entry snapshotted detail", &p.Entries.Snapshotted, c.entrySnapshottedDetail, changeCount); err != nil {
		return errors.Wrap(err, "entry snapshotted detail")
	}

	if err := applyPolicyLogDetailPtr(ctx, "entry ignored detail", &p.Entries.Ignored, c.entryIgnoredDetail, changeCount); err != nil {
		return errors.Wrap(err, "entry ignored detail")
	}

	if err := applyPolicyLogDetailPtr(ctx, "entry cache hit detail", &p.Entries.CacheHit, c.entryCacheHitDetail, changeCount); err != nil {
		return errors.Wrap(err, "entry cache hit detail")
	}

	if err := applyPolicyLogDetailPtr(ctx, "entry cache miss detail", &p.Entries.CacheMiss, c.entryCacheMissDetail, changeCount); err != nil {
		return errors.Wrap(err, "entry cache miss detail")
	}

	return nil
}

func applyPolicyLogDetailPtr(ctx context.Context, desc string, val **policy.LogDetail, str string, changeCount *int) error {

View on GitHub (pinned to 82495e54b5)