Tencent/WeKnora · error

bucket %q does not exist or is not accessible

Error message

bucket %q does not exist or is not accessible

What it means

OSS connectivity probe: IsBucketExist succeeded but reported the bucket absent, so credentials and endpoint work yet the configured bucket does not exist (or is invisible to this account); the probe fails as a configuration error.

Source

Thrown at internal/application/service/file/oss.go:131

		pathPrefix:     pathPrefix,
		bucketName:     bucketName,
		tempBucketName: tempBucketName,
	}, nil
}

// CheckOssConnectivity tests OSS connectivity using the provided credentials.
func CheckOssConnectivity(ctx context.Context, endpoint, region, accessKey, secretKey, bucketName string) error {
	client, err := newOSSClient(endpoint, region, accessKey, secretKey)
	if err != nil {
		return err
	}

	exists, err := client.IsBucketExist(ctx, bucketName)
	if err != nil {
		return fmt.Errorf("failed to check OSS bucket: %w", err)
	}
	if !exists {
		return fmt.Errorf("bucket %q does not exist or is not accessible", bucketName)
	}
	return nil
}

// parseOssFilePath extracts bucket and object key from: oss://{bucket}/{objectKey}
func parseOssFilePath(filePath string) (bucketName string, objectKey string, err error) {
	if !strings.HasPrefix(filePath, ossScheme) {
		return "", "", fmt.Errorf("invalid OSS file path: %s", filePath)
	}

	rest := strings.TrimPrefix(filePath, ossScheme)
	parts := strings.SplitN(rest, "/", 2)
	if len(parts) != 2 || parts[0] == "" || parts[1] == "" {
		return "", "", fmt.Errorf("invalid OSS file path: %s", filePath)
	}
	return parts[0], parts[1], nil
}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Create the bucket or correct its name in configuration
  2. Verify the credentials belong to the account owning the bucket
  3. Distinguish this configuration error from connectivity failures
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/application/service/file/oss.go:131 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/2dbff5f607bb3437. Report an issue: GitHub.