{"record":{"id":"04db30aa9a9a6ac5","repo":"benbjohnson/litestream","slug":"cannot-specify-url-bucket-for-s3-replica","errorCode":null,"errorMessage":"cannot specify url & bucket for s3 replica","messagePattern":"cannot specify url & bucket for s3 replica","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream/main.go","lineNumber":1458,"sourceCode":"\t// Expand home prefix and return absolute path.\n\tif configPath, err = expand(configPath); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Instantiate replica and apply time fields, if set.\n\tclient := file.NewReplicaClient(configPath)\n\tclient.Replica = r\n\treturn client, nil\n}\n\n// NewS3ReplicaClientFromConfig returns a new instance of s3.ReplicaClient built from config.\n// Exported for testing.\nfunc NewS3ReplicaClientFromConfig(c *ReplicaConfig, _ *litestream.Replica) (_ *s3.ReplicaClient, err error) {\n\t// Ensure URL & constituent parts are not both specified.\n\tif c.URL != \"\" && c.Path != \"\" {\n\t\treturn nil, fmt.Errorf(\"cannot specify url & path for s3 replica\")\n\t} else if c.URL != \"\" && c.Bucket != \"\" {\n\t\treturn nil, fmt.Errorf(\"cannot specify url & bucket for s3 replica\")\n\t}\n\n\tbucket, configPath := c.Bucket, c.Path\n\tregion, endpoint, skipVerify := c.Region, c.Endpoint, c.SkipVerify\n\tstorageClass := c.StorageClass\n\tsignSetting := newBoolSetting(true)\n\tif v := c.SignPayload; v != nil {\n\t\tsignSetting.Set(*v)\n\t}\n\tsignAcceptEncodingSetting := newBoolSetting(true)\n\tif v := c.SignAcceptEncoding; v != nil {\n\t\tsignAcceptEncodingSetting.Set(*v)\n\t}\n\trequireSetting := newBoolSetting(true)\n\tif v := c.RequireContentMD5; v != nil {\n\t\trequireSetting.Set(*v)\n\t}\n","sourceCodeStart":1440,"sourceCodeEnd":1476,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream/main.go#L1440-L1476","documentation":"Validation guard in NewS3ReplicaClientFromConfig that rejects an S3 replica config specifying both the full replica 'url' and the 'bucket' field. The URL already encodes the bucket in its host portion, so both being set is contradictory configuration. Fires when ReplicaConfig.URL and ReplicaConfig.Bucket are both non-empty.","triggerScenarios":"Thrown at cmd/litestream/main.go:1458 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Drop the url and keep bucket/path fields, or drop bucket and keep the s3://bucket/path url"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}