{"record":{"id":"98f51389d1bd0921","repo":"octobercms/october","slug":"invalid-data-attribute-type-supported-types-98f513","errorCode":null,"errorMessage":"Invalid data attribute type. Supported types: ","messagePattern":"Invalid data attribute type\\. Supported types: ","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/dashboard/classes/ReportDimensionFilter.php","lineNumber":48,"sourceCode":"    /**\n     * Creates a report data dimension filter.\n     * @param string $dataAttributeType Specifies the data attribute type.\n     * One of the ATTR_TYPE_* constants.\n     * @param ?string $attributeName Specifies the attribute name, e.g. a dimension field code.\n     * Must not be null if the data attribute type is ATTR_TYPE_DIMENSION_FIELD.\n     * Must be null if the data attribute type is ATTR_TYPE_DIMENSION.\n     * @param bool $operation Specifies the filter operation.\n     * One of the OPERATION_* constants.\n     * @param string|array|int|float|bool $value Specifies the filter value.\n     */\n    public function __construct(string $dataAttributeType, ?string $attributeName, string $operation, string|array|int|float|bool $value)\n    {\n        $knownAttributeTypes = [\n            self::ATTR_TYPE_DIMENSION,\n            self::ATTR_TYPE_DIMENSION_FIELD\n        ];\n        if (!in_array($dataAttributeType, $knownAttributeTypes)) {\n            throw new SystemException('Invalid data attribute type. Supported types: ' . implode(', ', $knownAttributeTypes));\n        }\n\n        if (!strlen($attributeName) && $dataAttributeType !== self::ATTR_TYPE_DIMENSION) {\n            throw new SystemException('Attribute name cannot be empty for ' . $dataAttributeType . ' data attribute type.');\n        }\n\n        if (strlen($attributeName) && $dataAttributeType === self::ATTR_TYPE_DIMENSION) {\n            throw new SystemException('Attribute name must be empty for ' . self::ATTR_TYPE_DIMENSION . ' data attribute type.');\n        }\n\n        if ($dataAttributeType === self::ATTR_TYPE_DIMENSION_FIELD) {\n            ReportDimensionField::validateCode($attributeName);\n        }\n\n        $knownOperations = [\n            self::OPERATION_EQUALS,\n            self::OPERATION_MORE_OR_EQUALS,\n            self::OPERATION_LESS_OR_EQUALS,","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/dashboard/classes/ReportDimensionFilter.php#L30-L66","documentation":"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.","triggerScenarios":"new ReportDimensionFilter('metric', 'oc_amount', ...) — 'metric' is a valid type for ReportDataOrderRule but NOT for filters; also raw strings like 'attr' or 'field'.","commonSituations":"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.","solutions":["Use only ReportDimensionFilter::ATTR_TYPE_DIMENSION or ReportDimensionFilter::ATTR_TYPE_DIMENSION_FIELD constants","Filter on the dimension's own column when type is dimension; on a dimension field code when type is dimension_field","Never reuse order-rule type constants for filters"],"exampleFix":"// before\n$filter = new ReportDimensionFilter('metric', 'total', ReportDimensionFilter::OPERATION_MORE, 100);\n\n// after — filter on the dimension itself\n$filter = new ReportDimensionFilter(\n    ReportDimensionFilter::ATTR_TYPE_DIMENSION,\n    null,\n    ReportDimensionFilter::OPERATION_MORE,\n    100\n);","handlingStrategy":"validation","validationCode":"$knownTypes = [\n    ReportDimensionFilter::ATTR_TYPE_DIMENSION,\n    ReportDimensionFilter::ATTR_TYPE_DIMENSION_FIELD,\n];\nif (!in_array($payload['type'], $knownTypes, true)) {\n    throw new InvalidArgumentException('Unsupported filter attribute type: ' . $payload['type']);\n}","typeGuard":"function isKnownFilterAttributeType(string $type): bool\n{\n    return in_array($type, [\n        ReportDimensionFilter::ATTR_TYPE_DIMENSION,\n        ReportDimensionFilter::ATTR_TYPE_DIMENSION_FIELD,\n    ], true);\n}","tryCatchPattern":null,"preventionTips":["Always pass ATTR_TYPE_* constants — never string literals","Do not reuse ReportDataOrderRule type constants for filters ('metric' is order-only)","Validate untrusted filter payloads at the request boundary and reject unknown types with 400"],"tags":["php","dashboard","report","filter","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}