juicedata/juicefs · error
invalid endpoint: %v, error: %v
Error message
invalid endpoint: %v, error: %v
What it means
url.ParseRequestURI rejected the Volcengine TOS endpoint after HTTPS scheme prefixing. Validation guard: the endpoint string is not a parseable URI, so the TOS SDK client cannot be constructed for it.
Source
Thrown at pkg/object/tos.go:316
return err
}
func (t *tosClient) Restore(ctx context.Context, key string, days int32) error {
_, err := t.client.RestoreObject(ctx, &tos.RestoreObjectInput{
Bucket: t.bucket,
Key: key,
Days: int(days),
RestoreJobParameters: &tos.RestoreJobParameters{Tier: enum.TierStandard},
})
return err
}
func newTOS(endpoint, accessKey, secretKey, token string) (ObjectStorage, error) {
if !strings.Contains(endpoint, "://") {
endpoint = fmt.Sprintf("https://%s", endpoint)
}
uri, err := url.ParseRequestURI(endpoint)
if err != nil {
return nil, fmt.Errorf("invalid endpoint: %v, error: %v", endpoint, err)
}
disableChecksum := strings.EqualFold(uri.Query().Get("disable-checksum"), "true")
if disableChecksum {
logger.Infof("default CRC checksum is disabled")
}
hostParts := strings.SplitN(uri.Host, ".", 3)
credentials := tos.NewStaticCredentials(accessKey, secretKey)
credentials.WithSecurityToken(token)
cli, err := tos.NewClientV2(
hostParts[1]+"."+hostParts[2],
tos.WithRegion(strings.TrimPrefix(hostParts[1], "tos-")),
tos.WithCredentials(credentials),
tos.WithUserAgentProductName(UserAgent),
tos.WithEnableVerifySSL(httpClient.Transport.(*http.Transport).TLSClientConfig.InsecureSkipVerify),
tos.WithEnableCRC(!disableChecksum))
if err != nil {
return nil, err
}View on GitHub (pinned to c9a67b23e8)
Solutions
- Print and inspect the endpoint string; remove whitespace/control characters
- Use a plain host like tos-cn-beijing.volces.com, or with an explicit https:// scheme
- Ensure the config value is actually substituted (no leftover {{var}} or $VAR)
- Percent-encode any characters that are not valid in a URL
Example fix
// before --storage-url "tos://tos cn-beijing.volces.com" // after --storage-url "tos://tos-cn-beijing.volces.com"
Defensive patterns
Strategy: validation
Validate before calling
func validTOSEndpoint(ep string) error {
if !strings.Contains(ep, "://") { ep = "https://" + ep }
_, err := url.ParseRequestURI(ep)
return err
} Try / catch
_, err := object.CreateStorage(ctx, "tos", url, ak, sk)
if err != nil && strings.HasPrefix(err.Error(), "invalid endpoint") {
// fix the endpoint string and retry
} Prevention
- Trim whitespace from endpoint config values
- Use host[:port] or a scheme-qualified URL only
- Template-expand config variables before use
When it happens
Trigger: Creating a TOS object store with an endpoint that is empty, contains illegal characters, or is otherwise unparseable as a URL even after adding the https:// scheme (e.g. "tos://bad url", "not%valid").
Common situations: Typo or stray whitespace in the endpoint config value; pasting a full TOS ARN instead of a host; config template variable left unexpanded; URL-encoded characters that break ParseRequestURI.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
Related errors
- Invalid endpoint %s: %s
- Invalid endpoint %s: %s
- invalid endpoint %s: %q
- found invalid key %s from List, prefix: %s, marker: %s
- ceph: can't put empty file
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/febf0c9e11a3b9c8.
Report an issue: GitHub.