kopia/kopia · error

Cannot specify a 'point-in-time' option when creating a…

Error message

Cannot specify a 'point-in-time' option when creating a repository

What it means

S3 'point-in-time' is a versioned-bucket recovery option for existing repositories. storageS3Flags.Connect rejects repository creation when PointInTime is non-zero, because a brand-new repository cannot be created at a past point in time.

Solutions

  1. Remove --point-in-time from the create command
  2. Use `repository connect s3 --point-in-time` for an existing repository
  3. Clear stale point-in-time values from config or environment

Example fix

// before
kopia repository create s3 --bucket b --point-in-time 2024-01-01
// after
kopia repository connect s3 --bucket b --point-in-time 2024-01-01
Defensive patterns

Strategy: validation

Validate before calling

if isCreate && opts.PointInTime != nil && !opts.PointInTime.IsZero() {
    return errors.New("point-in-time not allowed on create")
}

Try / catch

_, err := flags.Connect(ctx, true, ver)
if err != nil && strings.Contains(err.Error(), "point-in-time") {
    // strip the flag and retry
}

Prevention

When it happens

Trigger: `kopia repository create s3 ...` with --point-in-time set, or config/env injecting s3options.PointInTime during create.

Common situations: Scripts reusing a connect command line for create; leftover --point-in-time from versioning/PITR experiments.

Related errors


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

Appendix: source

Thrown at cli/storage_s3.go:86

	return nil
}

func (c *storageS3Flags) preActionLoadPEMBase64(_ *kingpin.ParseContext) error {
	caContent, err := base64.StdEncoding.DecodeString(c.rootCaPemBase64)
	if err != nil {
		return errors.Wrap(err, "unable to decode CA")
	}

	c.s3options.RootCA = caContent

	return nil
}

func (c *storageS3Flags) Connect(ctx context.Context, isCreate bool, formatVersion int) (blob.Storage, error) {
	_ = formatVersion

	if isCreate && c.s3options.PointInTime != nil && !c.s3options.PointInTime.IsZero() {
		return nil, errors.New("Cannot specify a 'point-in-time' option when creating a repository")
	}

	//nolint:wrapcheck
	return s3.New(ctx, &c.s3options, isCreate)
}

func init() {
	mustRegisterStorageProvider(
		"s3",
		"an S3 bucket",
		func() StorageFlags { return &storageS3Flags{} },
	)
}

View on GitHub (pinned to 82495e54b5)