benbjohnson/litestream · error
cannot specify url & path for gs replica
Error message
cannot specify url & path for gs replica
What it means
Validation guard in newGSReplicaClientFromConfig that rejects a Google Cloud Storage replica config specifying both the full replica 'url' and its constituent 'path' field, since the URL already encodes the object prefix. Fires when ReplicaConfig.URL and ReplicaConfig.Path are both non-empty.
Source
Thrown at cmd/litestream/main.go:1722
client.SSECustomerKey = strings.TrimSpace(string(keyData))
} else {
client.SSECustomerKey = c.SSECustomerKey
}
}
// Apply SSE-KMS configuration if specified.
if c.SSEKMSKeyID != "" {
client.SSEKMSKeyID = c.SSEKMSKeyID
}
return client, nil
}
// newGSReplicaClientFromConfig returns a new instance of gs.ReplicaClient built from config.
func newGSReplicaClientFromConfig(c *ReplicaConfig, _ *litestream.Replica) (_ *gs.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 gs replica")
} else if c.URL != "" && c.Bucket != "" {
return nil, fmt.Errorf("cannot specify url & bucket for gs replica")
}
bucket, configPath := c.Bucket, c.Path
// Apply settings from URL, if specified.
if c.URL != "" {
_, uhost, upath, err := litestream.ParseReplicaURL(c.URL)
if err != nil {
return nil, err
}
// Only apply URL parts to field that have not been overridden.
if configPath == "" {
configPath = upath
}
if bucket == "" {View on GitHub (pinned to 4ed7a308f6)
Solutions
- Keep only one: either the gs://bucket/path url or discrete bucket+path fields
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cmd/litestream/main.go:1722 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/08faea7c3413ea42.
Report an issue: GitHub.