{"record":{"id":"57da3cc280ccca96","repo":"keras-team/keras","slug":"unknown-loss-function-loss-item","errorCode":null,"errorMessage":"Unknown loss function: '{loss_item}'.","messagePattern":"Unknown loss function: '(.+?)'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/distillation/distillation_loss.py","lineNumber":26,"sourceCode":"def _convert_loss_to_function(loss_item):\n    \"\"\"Convert a loss string identifier to a loss function.\n\n    Arguments:\n        loss_item: Either a string identifier, a loss function instance,\n            or `None`.\n\n    Returns:\n        A loss function instance, or `None`.\n\n    Raises:\n        ValueError: If the loss string identifier is unknown.\n    \"\"\"\n    if loss_item is None:\n        return None\n    elif isinstance(loss_item, str):\n        loss_fn = keras.losses.get(loss_item)\n        if loss_fn is None:\n            raise ValueError(f\"Unknown loss function: '{loss_item}'.\")\n        return loss_fn\n    else:\n        return loss_item\n\n\n@keras_export(\"keras.distillation.DistillationLoss\")\nclass DistillationLoss:\n    \"\"\"Base class for distillation loss computation.\n\n    Distillation losses define how to compute the distillation loss\n    between teacher and student outputs. Each loss implements a specific\n    approach to knowledge transfer, from simple logits matching to feature-based\n    distillation.\n\n    To create custom distillation losses, subclass this class and\n    override the `compute_loss` method.\n    \"\"\"\n","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/distillation/distillation_loss.py#L8-L44","documentation":"Error \"Unknown loss function: '{loss_item}'.\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/distillation/distillation_loss.py:26 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":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}