Tencent/WeKnora · error
failed to get file from MinIO: %w
Error message
failed to get file from MinIO: %w
What it means
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).
Source
Thrown at internal/application/service/file/minio.go:156
_, err = s.client.PutObject(ctx, s.bucketName, objectName, src, file.Size, minio.PutObjectOptions{
ContentType: file.Header.Get("Content-Type"),
})
if err != nil {
return "", fmt.Errorf("failed to upload file to MinIO: %w", err)
}
return fmt.Sprintf("minio://%s/%s", s.bucketName, objectName), nil
}
// GetFile gets a file from MinIO
func (s *minioFileService) GetFile(ctx context.Context, filePath string) (io.ReadCloser, error) {
objectName, err := s.parseMinioFilePath(filePath)
if err != nil {
return nil, err
}
obj, err := s.client.GetObject(ctx, s.bucketName, objectName, minio.GetObjectOptions{})
if err != nil {
return nil, fmt.Errorf("failed to get file from MinIO: %w", err)
}
return obj, nil
}
// DeleteFile deletes a file
func (s *minioFileService) DeleteFile(ctx context.Context, filePath string) error {
objectName, err := s.parseMinioFilePath(filePath)
if err != nil {
return err
}
if err := s.client.RemoveObject(ctx, s.bucketName, objectName, minio.RemoveObjectOptions{
GovernanceBypass: true,
}); err != nil {
return fmt.Errorf("failed to delete file: %w", err)
}
return nil
}
View on GitHub (pinned to 988cbb0330)
Solutions
- Verify the object exists at the given path
- Check read permissions and MinIO health
- Distinguish not-found from transient errors when surfacing
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/application/service/file/minio.go:156 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/bac2f801945b968b.
Report an issue: GitHub.