{"record":{"id":"7ed20d3c049a3d37","repo":"deepset-ai/haystack","slug":"invalid-theme-params-theme-valid-options-ar","errorCode":null,"errorMessage":"Invalid theme: {params['theme']}. Valid options are: {valid_themes}.","messagePattern":"Invalid theme: (.+?)\\. Valid options are: (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"haystack/core/pipeline/draw.py","lineNumber":145,"sourceCode":"    :raises ValueError:\n        If any parameter is invalid or does not match the expected format.\n    \"\"\"\n    valid_img_types = {\"jpeg\", \"png\", \"webp\"}\n    valid_themes = {\"default\", \"neutral\", \"dark\", \"forest\"}\n    valid_formats = {\"img\", \"svg\", \"pdf\"}\n\n    params.setdefault(\"format\", \"img\")\n    params.setdefault(\"type\", \"png\")\n    params.setdefault(\"theme\", \"neutral\")\n\n    if params[\"format\"] not in valid_formats:\n        raise ValueError(f\"Invalid image format: {params['format']}. Valid options are: {valid_formats}.\")\n\n    if params[\"format\"] == \"img\" and params[\"type\"] not in valid_img_types:\n        raise ValueError(f\"Invalid image type: {params['type']}. Valid options are: {valid_img_types}.\")\n\n    if params[\"theme\"] not in valid_themes:\n        raise ValueError(f\"Invalid theme: {params['theme']}. Valid options are: {valid_themes}.\")\n\n    if \"width\" in params and not isinstance(params[\"width\"], int):\n        raise ValueError(\"Width must be an integer.\")\n    if \"height\" in params and not isinstance(params[\"height\"], int):\n        raise ValueError(\"Height must be an integer.\")\n\n    if \"scale\" in params and not 1 <= params[\"scale\"] <= 3:\n        raise ValueError(\"Scale must be a number between 1 and 3.\")\n    if \"scale\" in params and not (\"width\" in params or \"height\" in params):\n        raise ValueError(\"Scale is only allowed when width or height is set.\")\n\n    if \"bgColor\" in params and not isinstance(params[\"bgColor\"], str):\n        raise ValueError(\"Background color must be a string.\")\n\n    # PDF specific parameters\n    if params[\"format\"] == \"pdf\":\n        if \"fit\" in params and not isinstance(params[\"fit\"], bool):\n            raise ValueError(\"Fit must be a boolean.\")","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/core/pipeline/draw.py#L127-L163","documentation":"mermaid.ink supports a fixed set of themes. Haystack validates params['theme'] against that list and raises this ValueError for unknown themes.","triggerScenarios":"Passing params={'theme': 'light'} or a custom theme string instead of a supported one such as 'default', 'neutral', 'dark', 'forest'.","commonSituations":"Assuming CSS-like theme names; porting settings from other mermaid tooling.","solutions":["Use one of the themes listed in the error message (e.g. 'default', 'neutral', 'dark', 'forest')","Remove 'theme' to keep the 'neutral' default"],"exampleFix":"// before\npipeline.draw(path=\"g.png\", params={\"theme\": \"light\"})  # ValueError\n// after\npipeline.draw(path=\"g.png\", params={\"theme\": \"dark\"})","handlingStrategy":"validation","validationCode":"if params.get(\"theme\", \"neutral\") not in {\"default\", \"neutral\", \"dark\", \"forest\"}:\n    raise ValueError(\"unsupported theme\")","typeGuard":"def valid_theme(params: dict) -> bool:\n    return params.get(\"theme\", \"neutral\") in {\"default\", \"neutral\", \"dark\", \"forest\"}","tryCatchPattern":"try:\n    pipeline.draw(path, params=params)\nexcept ValueError as e:\n    if \"theme\" in str(e):\n        params[\"theme\"] = \"neutral\"","preventionTips":["Use only documented mermaid theme names","Default is 'neutral'; omit for consistency"],"tags":["mermaid","validation","drawing","params"],"backgroundTag":"invalid-enum-parameter","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}