juicedata/juicefs · error
create B2 client: %s
Error message
create B2 client: %s
What it means
Constructing the Backblaze B2 SDK client (backblaze.NewB2) failed while initializing a B2 object storage backend. Wraps the SDK error, which typically indicates invalid or missing keyID/applicationKey credentials or an unreachable B2 API endpoint during authorization.
Source
Thrown at pkg/object/b2.go:173
// TODO: support multipart upload using S3 client
func newB2(endpoint, keyID, applicationKey, 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)
}
hostParts := strings.Split(uri.Host, ".")
name := hostParts[0]
// TODO: set UserAgent once kothar/go-backblaze supports http.Client injection
client, err := backblaze.NewB2(backblaze.Credentials{
KeyID: keyID,
ApplicationKey: applicationKey,
})
if err != nil {
return nil, fmt.Errorf("create B2 client: %s", err)
}
client.MaxIdleUploads = 20
bucket, err := client.Bucket(name)
if err != nil {
logger.Warnf("access bucket %s: %s", name, err)
}
if err == nil && bucket == nil {
bucket, err = client.CreateBucket(name, "allPrivate")
if err != nil {
return nil, fmt.Errorf("create bucket %s: %s", name, err)
}
}
if bucket == nil {
return nil, fmt.Errorf("can't find bucket %s with provided Key ID", name)
}
return &b2client{bucket: bucket}, nil
}
View on GitHub (pinned to c9a67b23e8)
Solutions
- Verify keyID and applicationKey in the Backblaze B2 console / b2 CLI ('b2 authorize-account').
- Regenerate the application key if it was deleted or rotated.
- Confirm network access to api.backblazeb2.com.
- Check that keyID and applicationKey are not swapped in configuration.
Example fix
// before keyID: "abcd", applicationKey: "00112233" (wrong key) // after keyID: "003aabbccddefff0000000001", applicationKey: "K001validkey..."
Defensive patterns
Strategy: try-catch
Validate before calling
if keyID == "" || applicationKey == "" { return errors.New("B2 keyID and applicationKey are required") } Try / catch
client, err := backblaze.NewB2(backblaze.Credentials{KeyID: keyID, ApplicationKey: applicationKey})
if err != nil {
return fmt.Errorf("B2 authorization failed (check keyID/applicationKey and network): %w", err)
} Prevention
- Verify keys with 'b2 authorize-account' before deploying
- Rotate keys via the B2 console and update config atomically
- Confirm api.backblazeb2.com is reachable from the environment
When it happens
Trigger: newB2 with an application key ID or master/application key that is wrong, disabled, or revoked; network failure reaching the Backblaze auth endpoint.
Common situations: Swapped keyID/applicationKey; key deleted from Backblaze console; typo when pasting keys; corporate proxy blocking api.backblazeb2.com.
Related errors
- object storage: %s
- Failed to create Azure credential (managed identity/Azure CL
- Invalid endpoint: %v, error: %v
- create bucket %s: %s
- can't find bucket %s with provided Key ID
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/8f4fb29c98e5effb.
Report an issue: GitHub.