octobercms/october · error · SystemException

Invalid data attribute type. Supported types:

Error message

Invalid data attribute type. Supported types: 

What it means

ReportDimensionFilter's constructor validates $dataAttributeType against its two ATTR_TYPE_* constants: 'dimension' (ATTR_TYPE_DIMENSION) and 'dimension_field' (ATTR_TYPE_DIMENSION_FIELD). Any other string throws, listing the supported values.

Source

Thrown at modules/dashboard/classes/ReportDimensionFilter.php:48

    /**
     * Creates a report data dimension filter.
     * @param string $dataAttributeType Specifies the data attribute type.
     * One of the ATTR_TYPE_* constants.
     * @param ?string $attributeName Specifies the attribute name, e.g. a dimension field code.
     * Must not be null if the data attribute type is ATTR_TYPE_DIMENSION_FIELD.
     * Must be null if the data attribute type is ATTR_TYPE_DIMENSION.
     * @param bool $operation Specifies the filter operation.
     * One of the OPERATION_* constants.
     * @param string|array|int|float|bool $value Specifies the filter value.
     */
    public function __construct(string $dataAttributeType, ?string $attributeName, string $operation, string|array|int|float|bool $value)
    {
        $knownAttributeTypes = [
            self::ATTR_TYPE_DIMENSION,
            self::ATTR_TYPE_DIMENSION_FIELD
        ];
        if (!in_array($dataAttributeType, $knownAttributeTypes)) {
            throw new SystemException('Invalid data attribute type. Supported types: ' . implode(', ', $knownAttributeTypes));
        }

        if (!strlen($attributeName) && $dataAttributeType !== self::ATTR_TYPE_DIMENSION) {
            throw new SystemException('Attribute name cannot be empty for ' . $dataAttributeType . ' data attribute type.');
        }

        if (strlen($attributeName) && $dataAttributeType === self::ATTR_TYPE_DIMENSION) {
            throw new SystemException('Attribute name must be empty for ' . self::ATTR_TYPE_DIMENSION . ' data attribute type.');
        }

        if ($dataAttributeType === self::ATTR_TYPE_DIMENSION_FIELD) {
            ReportDimensionField::validateCode($attributeName);
        }

        $knownOperations = [
            self::OPERATION_EQUALS,
            self::OPERATION_MORE_OR_EQUALS,
            self::OPERATION_LESS_OR_EQUALS,

View on GitHub (pinned to b608633a7e)

Solutions

  1. Use only ReportDimensionFilter::ATTR_TYPE_DIMENSION or ReportDimensionFilter::ATTR_TYPE_DIMENSION_FIELD constants
  2. Filter on the dimension's own column when type is dimension; on a dimension field code when type is dimension_field
  3. Never reuse order-rule type constants for filters

Example fix

// before
$filter = new ReportDimensionFilter('metric', 'total', ReportDimensionFilter::OPERATION_MORE, 100);

// after — filter on the dimension itself
$filter = new ReportDimensionFilter(
    ReportDimensionFilter::ATTR_TYPE_DIMENSION,
    null,
    ReportDimensionFilter::OPERATION_MORE,
    100
);
Defensive patterns

Strategy: validation

Validate before calling

$knownTypes = [
    ReportDimensionFilter::ATTR_TYPE_DIMENSION,
    ReportDimensionFilter::ATTR_TYPE_DIMENSION_FIELD,
];
if (!in_array($payload['type'], $knownTypes, true)) {
    throw new InvalidArgumentException('Unsupported filter attribute type: ' . $payload['type']);
}

Type guard

function isKnownFilterAttributeType(string $type): bool
{
    return in_array($type, [
        ReportDimensionFilter::ATTR_TYPE_DIMENSION,
        ReportDimensionFilter::ATTR_TYPE_DIMENSION_FIELD,
    ], true);
}

Prevention

When it happens

Trigger: new ReportDimensionFilter('metric', 'oc_amount', ...) — 'metric' is a valid type for ReportDataOrderRule but NOT for filters; also raw strings like 'attr' or 'field'.

Common situations: Confusing ordering constants (ReportDataOrderRule has ATTR_TYPE_METRIC) with filter constants (ReportDimensionFilter has no metric type — metrics are not filterable attributes here); building filter objects from hand-written request payloads.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/98f51389d1bd0921. Report an issue: GitHub.