{"record":{"id":"63ffe4b284da76ad","repo":"unopim/unopim","slug":"validation-unique","errorCode":null,"errorMessage":"validation.unique","messagePattern":"validation\\.unique","errorType":"validation","errorClass":null,"httpStatus":422,"severity":"error","filePath":"packages/Webkul/Admin/src/Http/Controllers/Catalog/AttributeFamilyController.php","lineNumber":538,"sourceCode":"            ? [...$axes['level_1'], ...$axes['level_2']]\n            : $axes['level_1'];\n\n        if (! count($axes['level_1']) || ($levels === 2 && ! count($axes['level_2']))) {\n            abort(422, trans('validation.required', ['attribute' => 'structure.axes']));\n        }\n\n        if (count(array_unique($activeAxes)) !== count($activeAxes)) {\n            abort(422, trans('validation.distinct', ['attribute' => 'structure.axes']));\n        }\n\n        $codeExists = VariantStructure::query()\n            ->where('attribute_family_id', $attributeFamily->id)\n            ->where('code', $structureData['code'])\n            ->when(! empty($structureData['id']), fn ($query) => $query->where('id', '!=', $structureData['id']))\n            ->exists();\n\n        if ($codeExists) {\n            abort(422, trans('validation.unique', ['attribute' => 'code']));\n        }\n\n        foreach ($activeAxes as $axisCode) {\n            if (! $configurableAttributes->has($axisCode)) {\n                abort(422, trans('validation.exists', ['attribute' => $axisCode]));\n            }\n        }\n\n        foreach (($structureData['placements'] ?? []) as $level => $codes) {\n            if (! in_array($level, ['common', 'sub_parent', 'variant'], true)) {\n                abort(422, trans('validation.in', ['attribute' => $level]));\n            }\n\n            if ($levels === 1 && $level === 'sub_parent' && count($codes)) {\n                abort(422, trans('validation.in', ['attribute' => $level]));\n            }\n\n            foreach ($codes as $attributeCode) {","sourceCodeStart":520,"sourceCodeEnd":556,"githubUrl":"https://github.com/unopim/unopim/blob/c27a402253ed2bcee0f3eb16319fa7fc5eec5ffd/packages/Webkul/Admin/src/Http/Controllers/Catalog/AttributeFamilyController.php#L520-L556","documentation":"Error \"validation.unique\" thrown in unopim/unopim.","triggerScenarios":"Thrown at packages/Webkul/Admin/src/Http/Controllers/Catalog/AttributeFamilyController.php:538 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c27a402253ed2bcee0f3eb16319fa7fc5eec5ffd","analyzedAt":"2026-08-21T04:19:34.141Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}