apache/seatunnel · error · SensorsDataException

UNKNOWN_SOURCE_FIELD

UNKNOWN_SOURCE_FIELD

Error message

Field [%s] not found in source column

What it means

RowAccessor maps configured source fields to column indexes in the SensorsData event record. checkAndGetColumnIndex throws SensorsDataException with code UNKNOWN_SOURCE_FIELD when a requested field name has no entry in the parsed source column index map.

Source

Thrown at seatunnel-connectors-v2/connector-sensorsdata/src/main/java/org/apache/seatunnel/connectors/sensorsdata/format/record/RowAccessor.java:126

        Matcher matcher = EVENT_NAME_CONFIG_PATTERN.matcher(str);
        if (matcher.find()) {
            eventName = null;
            eventColumnIndex = checkAndGetColumnIndex(matcher.group(1));
        } else {
            eventName = str;
            eventColumnIndex = null;
        }
    }

    private Integer checkAndGetColumnIndex(String columnName) {
        if (StringUtils.isBlank(columnName)) {
            return null;
        }

        Integer index = columnIndex.get(columnName);
        if (index == null) {
            String message = String.format("Field [%s] not found in source column", columnName);
            throw new SensorsDataException(SensorsDataErrorCode.UNKNOWN_SOURCE_FIELD, message);
        }
        return index;
    }

    private void checkTargetColumnConfigs() {
        ArrayList<TargetColumnConfig> targetColumnConfigs =
                new ArrayList<>(config.getPropertyFields());

        if (config.getIdentityFields() != null) {
            targetColumnConfigs.addAll(config.getIdentityFields());
        }

        List<String> unknownSourceFields =
                targetColumnConfigs.stream()
                        .map(TargetColumnConfig::getSource)
                        .distinct()
                        .filter(source -> !columnIndex.containsKey(source))
                        .collect(toList());

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Print the available source column keys and compare with the configured field name to spot typos or casing differences
  2. Update the field config to a name actually present in the SensorsData payload
  3. If the field may be absent, remove it from required mappings or pre-filter events by event type
  4. Pin/adjust to the SDK schema version matching your SensorsData data

Example fix

// before
field = "distint_id"; // typo
// after
field = "distinct_id";
Defensive patterns

Strategy: validation

Validate before calling

// before building config, verify field exists in a sample payload
Set<String> available = samplePayload.keySet();
if (!available.contains(configuredField)) throw new ConfigException("Field not in payload: " + configuredField);

Try / catch

try { accessor.getIndex(fieldName); } catch (SensorsDataException e) { if (SensorsDataErrorCode.UNKNOWN_SOURCE_FIELD.equals(e.getErrorCode())) { log.error("Unknown field {}, available: {}", fieldName, availableColumns); } }

Prevention

When it happens

Trigger: A target column config (or event-name extraction field) references a field name that does not exist in the SensorsData JSON payload being read, and the accessor looks up its index.

Common situations: Typo in field name in the sink's field mapping config; SensorsData event schema changed (field renamed/removed); using a field only present in other event types.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/8d258c061f677620. Report an issue: GitHub.