diff --git a/weed/wdclient/filer_client.go b/weed/wdclient/filer_client.go index 3f665d775..bb5242c44 100644 --- a/weed/wdclient/filer_client.go +++ b/weed/wdclient/filer_client.go @@ -113,14 +113,19 @@ func (fc *FilerClient) GetLookupFileIdFunction() LookupFileIdFunctionType { // First try the cache using LookupVolumeIdsWithFallback vidLocations, err := fc.LookupVolumeIdsWithFallback(ctx, []string{volumeIdStr}) - if err != nil { - return nil, fmt.Errorf("LookupVolume %s failed: %v", fileId, err) - } - + + // Check for partial results first (important for multi-volume batched lookups) locations, found := vidLocations[volumeIdStr] if !found || len(locations) == 0 { + // Volume not found - return specific error with context from lookup if available + if err != nil { + return nil, fmt.Errorf("volume %s not found for fileId %s: %w", volumeIdStr, fileId, err) + } return nil, fmt.Errorf("volume %s not found for fileId %s", volumeIdStr, fileId) } + + // Volume found successfully - ignore any errors about other volumes + // (not relevant for single-volume lookup, but defensive for future batching) // Build URLs with publicUrl preference for _, loc := range locations { diff --git a/weed/wdclient/vidmap_client.go b/weed/wdclient/vidmap_client.go index 0457c246b..5e5d6f7b2 100644 --- a/weed/wdclient/vidmap_client.go +++ b/weed/wdclient/vidmap_client.go @@ -78,14 +78,19 @@ func (vc *vidMapClient) LookupFileIdWithFallback(ctx context.Context, fileId str // Use shared lookup logic with batching and singleflight vidLocations, err := vc.LookupVolumeIdsWithFallback(ctx, []string{volumeId}) - if err != nil { - return nil, fmt.Errorf("LookupVolume %s failed: %v", fileId, err) - } - + + // Check for partial results first (important for multi-volume batched lookups) locations, found := vidLocations[volumeId] if !found || len(locations) == 0 { + // Volume not found - return specific error with context from lookup if available + if err != nil { + return nil, fmt.Errorf("volume %s not found for fileId %s: %w", volumeId, fileId, err) + } return nil, fmt.Errorf("volume %s not found for fileId %s", volumeId, fileId) } + + // Volume found successfully - ignore any errors about other volumes + // (not relevant for single-volume lookup, but defensive for future batching) // Build HTTP URLs from locations, preferring same data center var sameDcUrls, otherDcUrls []string