{"record":{"id":"966d548ac5f73672","repo":"apache/superset","slug":"annotation-layer-parameters-are-invalid-966d54","errorCode":null,"errorMessage":"Annotation layer parameters are invalid.","messagePattern":"Annotation layer parameters are invalid\\.","errorType":"validation","errorClass":"AnnotationLayerInvalidError","httpStatus":422,"severity":"error","filePath":"superset/commands/annotation_layer/update.py","lineNumber":64,"sourceCode":"        self.validate()\n        assert self._model\n        return AnnotationLayerDAO.update(self._model, self._properties)\n\n    def validate(self) -> None:\n        exceptions: list[ValidationError] = []\n        name = self._properties.get(\"name\", \"\")\n        self._model = AnnotationLayerDAO.find_by_id(self._model_id)\n\n        if not self._model:\n            raise AnnotationLayerNotFoundError()\n\n        if not AnnotationLayerDAO.validate_update_uniqueness(\n            name, layer_id=self._model_id\n        ):\n            exceptions.append(AnnotationLayerNameUniquenessValidationError())\n\n        if exceptions:\n            raise AnnotationLayerInvalidError(exceptions=exceptions)\n","sourceCodeStart":46,"sourceCodeEnd":65,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/annotation_layer/update.py#L46-L65","documentation":"AnnotationLayerInvalidError (422) at the end of AnnotationLayerUpdateCommand.validate(): the layer exists, but validate_update_uniqueness(name, layer_id=self._model_id) found another layer (excluding this one) already using the requested name, so AnnotationLayerNameUniquenessValidationError was collected and re-raised here with it.","triggerScenarios":"PATCH /api/v1/annotation_layer/<id> renaming to a name owned by a different layer; two layers being swapped/merged by renaming both to the same value.","commonSituations":"Case-insensitive name collisions (e.g. 'deploys' vs 'Deploys'); merging layers by rename instead of moving annotations.","solutions":["Search for the target name first: GET /api/v1/annotation_layer/?q=(name:eq:<new_name>) and pick a different name if owned by another layer.","If merging layers, move annotations to the surviving layer rather than renaming the duplicate.","Use the field-level message in _exceptions[0] to surface 'Name must be unique' in the UI."],"exampleFix":"# before\nPATCH /api/v1/annotation_layer/12 {\"name\": \"Deploys\"}  # layer 3 already named Deploys\n\n# after\nPATCH /api/v1/annotation_layer/12 {\"name\": \"Deploys - archived\"}","handlingStrategy":"validation","validationCode":"from superset.daos.annotation_layer import AnnotationLayerDAO\n\nnew_name = properties[\"name\"]\nif not AnnotationLayerDAO.validate_update_uniqueness(new_name, layer_id=model_id):\n    return {\"error\": f\"name '{new_name}' already used by another layer\"}, 422","typeGuard":null,"tryCatchPattern":"try:\n    UpdateAnnotationLayerCommand(model_id, {\"name\": name}).run()\nexcept AnnotationLayerInvalidError as ex:\n    # ex._exceptions[0].messages == ['Name must be unique'] on field 'name'\n    suggest_alternative_name(name)","preventionTips":["Pre-check the new name with the annotation_layer filter API excluding the current id.","Remember uniqueness is enforced across layers, not just the edited one.","Merge layers by moving annotations rather than renaming onto an existing name."],"tags":["annotation-layer","validation","uniqueness","update"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}