HumanSignal/label-studio · warning · ValueError
Response is not list: {payload}
Error message
Response is not list: {payload} What it means
AllImportStorageListAPI._get_response proxies a per-storage-type list view and expects response.data to be a list. If the DRF view returns a non-list payload (object, dict, paginated response), it raises ValueError — but the method catches all exceptions, logs 'Can't process ...', and returns [] so that the aggregated sum() of lists still works.
Source
Thrown at label_studio/io_storages/all_api.py:144
extensions={
'x-fern-sdk-group-name': ['import_storage'],
'x-fern-sdk-method-name': 'list',
'x-fern-audiences': ['internal'],
},
),
)
class AllImportStorageListAPI(generics.ListAPIView):
queryset = S3ImportStorage.objects.none()
parser_classes = (JSONParser, FormParser, MultiPartParser)
permission_required = all_permissions.storages_view
def _get_response(self, api, request, *args, **kwargs):
try:
view = api.as_view()
response = view(request._request, *args, **kwargs)
payload = response.data
if not isinstance(payload, list):
raise ValueError(f'Response is not list: {payload}')
return payload
except Exception:
logger.error(f"Can't process {api.__class__.__name__}", exc_info=True)
return []
def list(self, request, *args, **kwargs):
list_responses = sum(
[self._get_response(s['import_list_api'], request, *args, **kwargs) for s in _common_storage_list], []
)
return Response(list_responses)
@method_decorator(
name='get',
decorator=extend_schema(
tags=['Storage'],
summary='List all export storages from the project',
description='Retrieve a list of the export storages of all types with their IDs.',View on GitHub (pinned to 0b49e9b539)
Solutions
- Check the error log for "Can't process <ApiName>" to identify which storage API failed.
- Ensure the storage type's list API returns a plain list (disable pagination or return .data list).
- Fix the misconfigured storage backend (credentials/bucket) causing the inner view to fail.
- Optionally make _get_response unwrap paginated objects ({'results': [...]}) before the isinstance check.
Example fix
// before
payload = response.data
if not isinstance(payload, list):
raise ValueError(f'Response is not list: {payload}')
// after
payload = response.data
if isinstance(payload, dict) and 'results' in payload:
payload = payload['results']
if not isinstance(payload, list):
raise ValueError(f'Response is not list: {payload}') Defensive patterns
Strategy: type-guard
Validate before calling
resp = view(request._request, *args, **kwargs)
payload = resp.data.get('results') if isinstance(resp.data, dict) else resp.data
if not isinstance(payload, list):
logger.warning('import storage list for %s returned non-list', api.__name__) Type guard
def is_list_payload(resp) -> bool:
data = resp.data.get('results') if isinstance(resp.data, dict) else resp.data
return isinstance(data, list) Try / catch
try:
payload = self._get_response(api, request, *args, **kwargs)
except ValueError:
payload = [] # per-type isolation: one bad backend shouldn't break the aggregate Prevention
- Keep inner storage list views pagination-free or unwrap 'results'.
- Log which storage API failed (already done) and alert on repeated occurrences.
- Add a contract test asserting each storage list API returns a JSON array.
When it happens
Trigger: A storage type's import_list_api view returning a paginated/serialized object payload instead of a plain list, or raising before producing list data — typically when one storage backend is misconfigured.
Common situations: Adding a new storage type whose list API returns a dict; pagination enabled on the inner view changing response shape; credentials misconfigured for S3/GCS/Azure causing the inner view to error and fall into the catch-all.
Related errors
- "file_upload_ids" parameter must be a list of integers
- sample() does not accept arguments.
- random(min, max) requires two arguments.
- choices(values:list, weights:list) requires one or two argum
- replace(old_value, new_value) requires two arguments.
AI-assisted analysis of HumanSignal/label-studio@0b49e9b539 (2026-08-29).
Data as JSON: /api/errors/c0b65203d9ce1526.
Report an issue: GitHub.