HumanSignal/label-studio · error · ValidationError

Choose a supported column type.

Error message

Choose a supported column type.

What it means

_validate_column_request checks request_data['value_type'] against the allowed set {'String','Number','Expression'}. Any other value_type raises ValidationError {'value_type': 'Choose a supported column type.'}. It is a strict input validation on the Add/Update Columns action payload.

Source

Thrown at label_studio/data_manager/actions/data_columns.py:35

from rest_framework.exceptions import PermissionDenied, ValidationError
from tasks.models import Task

all_permissions = AllPermissions()


def add_or_modify_columns_enabled(project):
    return flag_set('fflag_utc_1012_add_or_modify_columns', organization=project.organization)


def _validate_column_request(request_data, project):
    value_name = (
        request_data.get('column_name') or request_data.get('value_name') or request_data.get('existing_column')
    )
    value_type = request_data.get('value_type', 'String')
    value = request_data.get('value', '')

    if value_type not in {'String', 'Number', 'Expression'}:
        raise ValidationError({'value_type': 'Choose a supported column type.'})

    if not isinstance(value_name, str) or not value_name.strip():
        raise ValidationError({'column_name': 'Select an existing column or enter a new column name.'})

    value_name = value_name.strip()
    column_exists = value_name in project.summary.all_data_columns
    if not column_exists:
        column_exists = project.tasks.filter(data__has_key=value_name).exists()
    mode = 'update' if column_exists else 'add'
    # Existing columns (e.g. imported spreadsheet headers) stay editable, but a new column must be
    # one the Data Manager can filter and sort on.
    if mode == 'add' and not is_queryable_column_name(value_name):
        raise ValidationError(
            {'column_name': f'Column name cannot contain {UNQUERYABLE_COLUMN_NAME_CHARACTERS}.'},
        )
    try:
        value = {'String': str, 'Number': float, 'Expression': str}[value_type](value)
    except (TypeError, ValueError) as exc:

View on GitHub (pinned to 0b49e9b539)

Solutions

  1. Send value_type exactly as one of 'String', 'Number', or 'Expression' (case-sensitive).
  2. Omit value_type to get the default 'String'.
  3. Fix the calling client to normalize value_type before submitting.

Example fix

// before
{'value_type': 'Integer', 'value': '42', 'column_name': 'score'}
// after
{'value_type': 'Number', 'value': '42', 'column_name': 'score'}
Defensive patterns

Strategy: validation

Validate before calling

ALLOWED = {'String', 'Number', 'Expression'}
assert request_data.get('value_type', 'String') in ALLOWED, 'value_type must be String, Number, or Expression'

Type guard

def has_valid_value_type(payload):
    return payload.get('value_type', 'String') in {'String', 'Number', 'Expression'}

Try / catch

from rest_framework.exceptions import ValidationError
try:
    add_data_field(project, qs, request=request)
except ValidationError as e:
    handle_field_errors(e.message_dict)  # {'value_type': [...]}

Prevention

When it happens

Trigger: Submitting the add_data_field action with value_type set to e.g. 'Int', 'string' (wrong case), 'Boolean', or an empty value_type other than the default.

Common situations: Custom scripts calling the Data Manager action API with a guessed value_type; frontend sending value_type in the wrong case; API changed between versions adding/removing supported types.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of HumanSignal/label-studio@0b49e9b539 (2026-08-29). Data as JSON: /api/errors/37ae5c4ead847802. Report an issue: GitHub.