{"record":{"id":"bac2f801945b968b","repo":"Tencent/WeKnora","slug":"failed-to-get-file-from-minio-w","errorCode":null,"errorMessage":"failed to get file from MinIO: %w","messagePattern":"failed to get file from MinIO: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/file/minio.go","lineNumber":156,"sourceCode":"\t_, err = s.client.PutObject(ctx, s.bucketName, objectName, src, file.Size, minio.PutObjectOptions{\n\t\tContentType: file.Header.Get(\"Content-Type\"),\n\t})\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to upload file to MinIO: %w\", err)\n\t}\n\n\treturn fmt.Sprintf(\"minio://%s/%s\", s.bucketName, objectName), nil\n}\n\n// GetFile gets a file from MinIO\nfunc (s *minioFileService) GetFile(ctx context.Context, filePath string) (io.ReadCloser, error) {\n\tobjectName, err := s.parseMinioFilePath(filePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tobj, err := s.client.GetObject(ctx, s.bucketName, objectName, minio.GetObjectOptions{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get file from MinIO: %w\", err)\n\t}\n\treturn obj, nil\n}\n\n// DeleteFile deletes a file\nfunc (s *minioFileService) DeleteFile(ctx context.Context, filePath string) error {\n\tobjectName, err := s.parseMinioFilePath(filePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := s.client.RemoveObject(ctx, s.bucketName, objectName, minio.RemoveObjectOptions{\n\t\tGovernanceBypass: true,\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"failed to delete file: %w\", err)\n\t}\n\treturn nil\n}\n","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/file/minio.go#L138-L174","documentation":"Storage error in minioFileService.GetFile: after the minio:// path was parsed, s.client.GetObject against the configured bucket failed. The %w wraps the underlying MinIO SDK error (missing object, bad credentials, network) so callers can inspect the root cause; it fires only on transport/SDK failure, not on bad paths (which are rejected earlier by parseMinioFilePath).","triggerScenarios":"Thrown at internal/application/service/file/minio.go:156 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the object exists at the given path","Check read permissions and MinIO health","Distinguish not-found from transient errors when surfacing"],"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-08T10:18:20.063Z"}