benbjohnson/litestream · error
cannot specify url & path for s3 replica
Error message
cannot specify url & path for s3 replica
What it means
Validation guard in NewS3ReplicaClientFromConfig that rejects an S3 replica config specifying both the full replica 'url' and its constituent 'path' field, since combining them would leave the final object key ambiguous. Fires when ReplicaConfig.URL is non-empty and ReplicaConfig.Path is also set.
Source
Thrown at cmd/litestream/main.go:1456
}
// Expand home prefix and return absolute path.
if configPath, err = expand(configPath); err != nil {
return nil, err
}
// Instantiate replica and apply time fields, if set.
client := file.NewReplicaClient(configPath)
client.Replica = r
return client, nil
}
// NewS3ReplicaClientFromConfig returns a new instance of s3.ReplicaClient built from config.
// Exported for testing.
func NewS3ReplicaClientFromConfig(c *ReplicaConfig, _ *litestream.Replica) (_ *s3.ReplicaClient, err error) {
// Ensure URL & constituent parts are not both specified.
if c.URL != "" && c.Path != "" {
return nil, fmt.Errorf("cannot specify url & path for s3 replica")
} else if c.URL != "" && c.Bucket != "" {
return nil, fmt.Errorf("cannot specify url & bucket for s3 replica")
}
bucket, configPath := c.Bucket, c.Path
region, endpoint, skipVerify := c.Region, c.Endpoint, c.SkipVerify
storageClass := c.StorageClass
signSetting := newBoolSetting(true)
if v := c.SignPayload; v != nil {
signSetting.Set(*v)
}
signAcceptEncodingSetting := newBoolSetting(true)
if v := c.SignAcceptEncoding; v != nil {
signAcceptEncodingSetting.Set(*v)
}
requireSetting := newBoolSetting(true)
if v := c.RequireContentMD5; v != nil {
requireSetting.Set(*v)View on GitHub (pinned to 4ed7a308f6)
Solutions
- Remove either the url field or the path field from the replica config
- Put the whole destination in one place: s3://bucket/path in url, or bucket+path fields
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cmd/litestream/main.go:1456 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of benbjohnson/litestream@4ed7a308f6 (2026-09-06).
Data as JSON: /api/errors/681ffe5dd7bc0a46.
Report an issue: GitHub.