juicedata/juicefs · error

CIFS password/sk is required

Error message

CIFS password/sk is required

What it means

newCifs requires a non-empty password (mapped to the secret-key parameter). SMB session setup normally requires the password matching the username; without it the client cannot complete authentication, so construction fails right after the username check.

Source

Thrown at pkg/object/cifs.go:514

	if len(parts) > 2 && parts[2] != "" {
		err = fmt.Errorf("endpoint should be a valid share name (%s)", "\\\\<server>\\<share>")
		return
	}
	share = parts[1]
	return
}

func newCifs(endpoint, username, password, _ string) (ObjectStorage, error) {
	host, port, share, err := parseEndpoint(endpoint)
	if err != nil {
		return nil, err
	}
	if username == "" {
		return nil, fmt.Errorf("CIFS username/ak is required")
	}

	if password == "" {
		return nil, fmt.Errorf("CIFS password/sk is required")
	}

	maxPool := 8
	if v := os.Getenv("JFS_CIFS_MAX_POOL"); v != "" {
		if n, err := strconv.Atoi(v); err == nil {
			maxPool = n
		}
	}

	store := &cifsStore{
		host:            host,
		port:            port,
		share:           share,
		user:            username,
		password:        password,
		connIdleTimeout: 5 * time.Minute,
		pool:            make(chan *cifsConn, maxPool),
	}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Provide the SMB password as the secret-key parameter of the cifs storage URI.
  2. Verify the secret-key environment variable/config field is set and non-empty (after trimming).
  3. If using Kerberos/SSO where a password is not used, still satisfy the driver by supplying the required credential fields as expected by this driver.

Example fix

// before
newCifs("cifs://server/share", "smbuser", "")
// after
newCifs("cifs://server/share", "smbuser", "s3cret")
Defensive patterns

Strategy: validation

Validate before calling

if sk == "" {
    return fmt.Errorf("cifs storage requires a password (secret key); got empty value")
}

Try / catch

obj, err := object.CreateStorage("cifs", endpoint, ak, sk, "")
if err != nil && strings.Contains(err.Error(), "password/sk is required") {
    return fmt.Errorf("missing SMB password: set secret key for user %s", ak)
}

Prevention

When it happens

Trigger: Calling newCifs(endpoint, username, "", _) — missing secret-key in the cifs storage URI or empty env/config value; tests TestCifs/TestCifs2 passing an empty password.

Common situations: Secret not injected into the environment (CI/CD secret missing); user stored only the access key; whitespace-only value trimmed to empty.

Related errors


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