{"record":{"id":"787c1a33e8cb2138","repo":"Tencent/WeKnora","slug":"failed-to-create-bucket-w","errorCode":null,"errorMessage":"failed to create bucket: %w","messagePattern":"failed to create bucket: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/file/minio.go","lineNumber":64,"sourceCode":"}\n\n// NewMinioFileService creates a MinIO file service.\n// It verifies that the bucket exists and creates it if missing.\nfunc NewMinioFileService(endpoint,\n\taccessKeyID, secretAccessKey, bucketName string, useSSL bool,\n) (interfaces.FileService, error) {\n\tsvc, err := newMinioClient(endpoint, accessKeyID, secretAccessKey, bucketName, useSSL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\texists, err := svc.client.BucketExists(context.Background(), bucketName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to check bucket: %w\", err)\n\t}\n\tif !exists {\n\t\tif err = svc.client.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{}); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create bucket: %w\", err)\n\t\t}\n\t}\n\n\treturn svc, nil\n}\n\n// CheckConnectivity verifies MinIO is reachable and, if a bucket is configured,\n// that the bucket exists. This is a read-only probe — it never creates a bucket.\nfunc (s *minioFileService) CheckConnectivity(ctx context.Context) error {\n\tcheckCtx, cancel := context.WithTimeout(ctx, 10*time.Second)\n\tdefer cancel()\n\n\tif s.bucketName != \"\" {\n\t\texists, err := s.client.BucketExists(checkCtx, s.bucketName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !exists {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/file/minio.go#L46-L82","documentation":"MinIO service constructor: the configured bucket was found missing and MakeBucket failed while trying to create it, so the file service cannot initialize and construction aborts with the wrapped cause.","triggerScenarios":"Thrown at internal/application/service/file/minio.go:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check MinIO credentials have bucket-creation permission","Pre-create the bucket manually and retry initialization","Inspect the wrapped error for policy/limits on the MinIO server"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}