Tencent/WeKnora · error

failed to check TOS bucket: %w

Error message

failed to check TOS bucket: %w

What it means

TOS bucket bootstrap: the initial HeadBucket failed with an error other than 404 (auth, network, or throttling), so existence could not be determined and the ensure step fails with the wrapped probe error.

Source

Thrown at internal/application/service/file/tos.go:144

	if err == nil {
		return nil
	}

	var serverErr *tos.TosServerError
	if errors.As(err, &serverErr) && serverErr.StatusCode == 404 {
		_, createErr := client.CreateBucketV2(context.Background(), &tos.CreateBucketV2Input{
			Bucket: bucketName,
		})
		if createErr == nil {
			return nil
		}
		if errors.As(createErr, &serverErr) && serverErr.StatusCode == 409 {
			return nil
		}
		return fmt.Errorf("failed to create TOS bucket: %w", createErr)
	}

	return fmt.Errorf("failed to check TOS bucket: %w", err)
}

func joinTOSObjectKey(parts ...string) string {
	filtered := make([]string, 0, len(parts))
	for _, part := range parts {
		part = strings.Trim(part, "/")
		if part != "" {
			filtered = append(filtered, part)
		}
	}
	return strings.Join(filtered, "/")
}

func parseTOSFilePath(filePath string) (bucketName string, objectKey string, err error) {
	if !strings.HasPrefix(filePath, tosScheme) {
		return "", "", fmt.Errorf("invalid TOS file path: %s", filePath)
	}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Verify TOS endpoint, region, and credentials
  2. Check network egress and throttling limits
  3. Retry the bucket check on transient errors
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/application/service/file/tos.go:144 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/488f808c6cb66e00. Report an issue: GitHub.