{"record":{"id":"6a9888abef568356","repo":"benbjohnson/litestream","slug":"bucket-required-for-oss-replica-url","errorCode":null,"errorMessage":"bucket required for oss replica URL","messagePattern":"bucket required for oss replica URL","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"oss/replica_client.go","lineNumber":97,"sourceCode":"func NewReplicaClient() *ReplicaClient {\n\treturn &ReplicaClient{\n\t\tlogger: slog.Default().WithGroup(ReplicaClientType),\n\t}\n}\n\nfunc (c *ReplicaClient) SetLogger(logger *slog.Logger) {\n\tc.logger = logger.WithGroup(ReplicaClientType)\n}\n\n// NewReplicaClientFromURL creates a new ReplicaClient from URL components.\n// This is used by the replica client factory registration.\n// URL format: oss://bucket[.oss-region.aliyuncs.com]/path\nfunc NewReplicaClientFromURL(scheme, host, urlPath string, query url.Values, userinfo *url.Userinfo) (litestream.ReplicaClient, error) {\n\tclient := NewReplicaClient()\n\n\tbucket, region, _ := ParseHost(host)\n\tif bucket == \"\" {\n\t\treturn nil, fmt.Errorf(\"bucket required for oss replica URL\")\n\t}\n\n\tclient.Bucket = bucket\n\tclient.Region = region\n\tclient.Path = urlPath\n\n\treturn client, nil\n}\n\n// Type returns \"oss\" as the client type.\nfunc (c *ReplicaClient) Type() string {\n\treturn ReplicaClientType\n}\n\n// Init initializes the connection to OSS. No-op if already initialized.\nfunc (c *ReplicaClient) Init(ctx context.Context) (err error) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/oss/replica_client.go#L79-L115","documentation":"NewReplicaClientFromURL for OSS found no bucket: the oss:// URL host was empty or did not resolve to a bucket (expected format oss://bucket[.oss-region.aliyuncs.com]/path). The bucket is mandatory for replication.","triggerScenarios":"Thrown at oss/replica_client.go:97 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the URL to include the bucket host, e.g. oss://my-bucket.oss-cn-hangzhou.aliyuncs.com/path"],"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-14T05:17:10.506Z"}