juicedata/juicefs · error

Invalid endpoint %s: %s

Error message

Invalid endpoint %s: %s

What it means

newCeph wraps the endpoint in a ceph:// scheme and parses it with url.ParseRequestURI. If parsing fails, the endpoint is not a valid absolute URI and the Ceph object-store constructor aborts with this message.

Source

Thrown at pkg/object/ceph.go:336

				break
			} else if results[j] != nil {
				objs <- results[j]
			}
			ready[j] = false
			conds[j].Signal()
			ms[j].Unlock()
		}
	}()
	return objs, nil
}

func newCeph(endpoint, cluster, user, token string) (ObjectStorage, error) {
	if !strings.Contains(endpoint, "://") {
		endpoint = fmt.Sprintf("ceph://%s", endpoint)
	}
	uri, err := url.ParseRequestURI(endpoint)
	if err != nil {
		return nil, fmt.Errorf("Invalid endpoint %s: %s", endpoint, err)
	}
	name := uri.Host
	conn, err := rados.NewConnWithClusterAndUser(cluster, user)
	if err != nil {
		return nil, fmt.Errorf("Can't create connection to cluster %s for user %s: %s", cluster, user, err)
	}
	if opt := os.Getenv("CEPH_ADMIN_SOCKET"); opt != "none" {
		if opt == "" {
			opt = "$run_dir/jfs-$cluster-$name-$pid.asok"
		}
		if err = conn.SetConfigOption("admin_socket", opt); err != nil {
			logger.Warnf("Failed to set admin_socket to %s: %s", opt, err)
		}
	}
	if opt := os.Getenv("CEPH_LOG_FILE"); opt != "none" {
		if opt == "" {
			opt = "/var/log/ceph/jfs-$cluster-$name.log"
		}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Provide a valid endpoint that parses as a URI, e.g. ceph://mon1.example.com
  2. Remove whitespace, quotes, or invalid URL characters from the endpoint
  3. Ensure the endpoint is non-empty in your storage config

Example fix

// before
newCeph("mon1 mon2", "mycluster", "admin", "")
// after
newCeph("mon1.example.com", "mycluster", "admin", "")
Defensive patterns

Strategy: validation

Validate before calling

// Go
u, err := url.ParseRequestURI(endpoint)
if err != nil || u.Host == "" {
    return fmt.Errorf("invalid ceph endpoint: %q", endpoint)
}

Try / catch

// Go
obj, err := object.NewCeph(endpoint, cluster, user, token)
if err != nil && strings.Contains(err.Error(), "Invalid endpoint") {
    log.Fatalf("fix ceph endpoint in config: %v", err)
}

Prevention

When it happens

Trigger: Passing an unparseable endpoint (empty, spaces, invalid characters) to the ceph object storage constructor, e.g. via --storage-endpoint ceph://... configuration.

Common situations: Malformed monitor/endpoint string in config; empty endpoint after env-var interpolation; copy-paste artifacts (quotes, trailing slashes with spaces).

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


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/bf9fa0e8989c7cb6. Report an issue: GitHub.