{"record":{"id":"28c10bbc08aac21d","repo":"juicedata/juicefs","slug":"invalid-endpoint-v","errorCode":null,"errorMessage":"Invalid endpoint: %v","messagePattern":"Invalid endpoint: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/bos.go","lineNumber":300,"sourceCode":"\n\tif location, err := bosCli.GetBucketLocation(bucketName); err != nil {\n\t\treturn \"\", err\n\t} else {\n\t\treturn fmt.Sprintf(\"%s.bcebos.com\", location), nil\n\t}\n}\n\nfunc newBOS(endpoint, accessKey, secretKey, token string) (ObjectStorage, error) {\n\tif !strings.Contains(endpoint, \"://\") {\n\t\tendpoint = fmt.Sprintf(\"https://%s\", endpoint)\n\t}\n\turi, err := url.ParseRequestURI(endpoint)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Invalid endpoint: %v, error: %v\", endpoint, err)\n\t}\n\thostParts := strings.SplitN(uri.Host, \".\", 2)\n\tif len(hostParts) != 2 {\n\t\treturn nil, fmt.Errorf(\"Invalid endpoint: %v\", endpoint)\n\t}\n\tbucketName := hostParts[0]\n\tif accessKey == \"\" {\n\t\taccessKey = os.Getenv(\"BDCLOUD_ACCESS_KEY\")\n\t\tsecretKey = os.Getenv(\"BDCLOUD_SECRET_KEY\")\n\t}\n\tendpoint = hostParts[1]\n\tif hostParts[1] == \"bcebos.com\" {\n\t\tif endpoint, err = autoBOSEndpoint(bucketName, accessKey, secretKey); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Fail to get location of bucket %q: %s\", bucketName, err)\n\t\t}\n\t}\n\tendpoint = fmt.Sprintf(\"%s://%s\", uri.Scheme, endpoint)\n\tlogger.Debugf(\"Use endpoint: %s\", endpoint)\n\t// endpoint format like https://bj.bcebos.com\n\tbosClient, err := bos.NewClient(accessKey, secretKey, endpoint)\n\tif err != nil {\n\t\treturn nil, err","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/bos.go#L282-L318","documentation":"After the endpoint parses as a URI, newBOS splits uri.Host on the first dot expecting \"<bucket>.<region-domain>\" (e.g. mybucket.bj.bcebos.com). If the host has no dot, no bucket name can be extracted and the constructor rejects the endpoint with this message.","triggerScenarios":"Endpoints like \"https://bcebos.com\", \"https://localhost\", or \"myendpoint\" where the host portion contains no dot; also a URL whose scheme parsing left an empty host.","commonSituations":"Passing only the service domain instead of the bucket-prefixed virtual-host endpoint; using an IP-address endpoint for a self-hosted BOS-compatible service; forgetting to prefix the bucket name.","solutions":["Use the virtual-hosted form: <bucket>.<region>.bcebos.com","If using a custom domain, include the bucket as the first host label (e.g. mybucket.svc.example.com)","Check the endpoint is not just the region domain (bj.bcebos.com) — the bucket label must be present"],"exampleFix":"// before\nnewBOS(\"https://bj.bcebos.com\", ak, sk, \"\")\n// after\nnewBOS(\"https://mybucket.bj.bcebos.com\", ak, sk, \"\")","handlingStrategy":"validation","validationCode":"// Go: ensure bucket-prefixed host with at least one dot\nparts := strings.SplitN(u.Host, \".\", 2)\nif len(parts) != 2 || parts[0] == \"\" {\n    return fmt.Errorf(\"endpoint host must be <bucket>.<domain>, got %q\", u.Host)\n}","typeGuard":null,"tryCatchPattern":"// Go\nobj, err := object.NewBOS(endpoint, ak, sk, \"\")\nif err != nil && strings.Contains(err.Error(), \"Invalid endpoint\") {\n    log.Fatalf(\"check BOS endpoint format <bucket>.<region>.bcebos.com: %v\", err)\n}","preventionTips":["Always use virtual-hosted style: <bucket>.<region>.bcebos.com","Never point the client at the bare service domain","Document expected endpoint format in deployment config templates"],"tags":["object-storage","baidu-bos","endpoint-format","configuration"],"backgroundTag":"invalid-url-format","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}