{"record":{"id":"400cff6dcceabf4f","repo":"Tencent/WeKnora","slug":"failed-to-upload-file-to-minio-w","errorCode":null,"errorMessage":"failed to upload file to MinIO: %w","messagePattern":"failed to upload file to MinIO: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/file/minio.go","lineNumber":142,"sourceCode":"\tfile *multipart.FileHeader, tenantID uint64, knowledgeID string,\n) (string, error) {\n\t// Generate object name\n\text := filepath.Ext(file.Filename)\n\tobjectName := fmt.Sprintf(\"%d/%s/%s%s\", tenantID, knowledgeID, uuid.New().String(), ext)\n\n\t// Open file\n\tsrc, err := file.Open()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to open file: %w\", err)\n\t}\n\tdefer src.Close()\n\n\t// Upload file to MinIO\n\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","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/file/minio.go#L124-L160","documentation":"MinIO PutObject failed while uploading the opened multipart file to the generated object key, meaning the object was not stored; network issues, bucket permissions, or size limits are typical causes and the failure is wrapped for the caller.","triggerScenarios":"Thrown at internal/application/service/file/minio.go:142 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check MinIO reachability and write permissions","Verify bucket size/quota limits","Retry the upload; the object key is new so no partial overwrite risk"],"exampleFix":null,"handlingStrategy":"retry","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"}