{"record":{"id":"5a10b476d4539c0c","repo":"deepset-ai/haystack","slug":"the-value-of-parameter-meta-value-type-must-be","errorCode":null,"errorMessage":"The value of parameter <meta_value_type> must be 'float', 'int', 'date' or None but is currently set to '{meta_value_type}'.\nChange the <meta_value_type> value to 'float', 'int', 'date' or None when initializing the MetaFieldRanker.","messagePattern":"The value of parameter <meta_value_type> must be 'float', 'int', 'date' or None but is currently set to '(.+?)'\\.\nChange the <meta_value_type> value to 'float', 'int', 'date' or None when initializing the MetaFieldRanker\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"haystack/components/rankers/meta_field.py","lineNumber":155,"sourceCode":"\n        if sort_order not in [\"ascending\", \"descending\"]:\n            raise ValueError(\n                \"The value of parameter <sort_order> must be 'ascending' or 'descending', \"\n                f\"but is currently set to '{sort_order}'.\\n\"\n                \"Change the <sort_order> value to 'ascending' or 'descending' when initializing the \"\n                \"MetaFieldRanker.\"\n            )\n\n        if missing_meta not in [\"drop\", \"top\", \"bottom\"]:\n            raise ValueError(\n                \"The value of parameter <missing_meta> must be 'drop', 'top', or 'bottom', \"\n                f\"but is currently set to '{missing_meta}'.\\n\"\n                \"Change the <missing_meta> value to 'drop', 'top', or 'bottom' when initializing the \"\n                \"MetaFieldRanker.\"\n            )\n\n        if meta_value_type not in [\"float\", \"int\", \"date\", None]:\n            raise ValueError(\n                \"The value of parameter <meta_value_type> must be 'float', 'int', 'date' or None but is \"\n                f\"currently set to '{meta_value_type}'.\\n\"\n                \"Change the <meta_value_type> value to 'float', 'int', 'date' or None when initializing the \"\n                \"MetaFieldRanker.\"\n            )\n\n    @component.output_types(documents=list[Document])\n    def run(\n        self,\n        documents: list[Document],\n        top_k: int | None = None,\n        weight: float | None = None,\n        ranking_mode: Literal[\"reciprocal_rank_fusion\", \"linear_score\"] | None = None,\n        sort_order: Literal[\"ascending\", \"descending\"] | None = None,\n        missing_meta: Literal[\"drop\", \"top\", \"bottom\"] | None = None,\n        meta_value_type: Literal[\"float\", \"int\", \"date\"] | None = None,\n    ) -> dict[str, Any]:\n        \"\"\"","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/components/rankers/meta_field.py#L137-L173","documentation":"MetaFieldRanker sorts documents by a metadata field, and meta_value_type tells it how to parse the values (as float, int, or date). The library only accepts 'float', 'int', 'date' or None; anything else makes sorting semantics ambiguous, so _validate_params raises a ValueError at init or run time.","triggerScenarios":"MetaFieldRanker(meta_value_type=\"str\") or any misspelled/other value such as \"number\", \"Float\", \"datetime\" — validated in __init__ and again in run().","commonSituations":"Typo in the type string, copying config from another ranker, using a type name from another library (e.g. 'datetime' or 'number'), or programmatic pipeline YAML with a wrong value.","solutions":["Set meta_value_type to exactly one of 'float', 'int', 'date', or omit it (None)","Fix the string casing/spelling (Python string compare is case-sensitive)","If values are strings, remove meta_value_type or use 'date' with ISO-formatted date strings"],"exampleFix":"// before\nranker = MetaFieldRanker(meta_field=\"rating\", meta_value_type=\"number\")\n// after\nranker = MetaFieldRanker(meta_field=\"rating\", meta_value_type=\"float\")","handlingStrategy":"validation","validationCode":"VALID = {\"float\", \"int\", \"date\", None}\nif meta_value_type not in VALID:\n    raise ValueError(f\"meta_value_type must be one of 'float','int','date',None, got {meta_value_type!r}\")","typeGuard":"def is_valid_meta_value_type(t: object) -> bool:\n    return t in (\"float\", \"int\", \"date\", None)","tryCatchPattern":"try:\n    ranker = MetaFieldRanker(meta_field=\"rating\", meta_value_type=t)\nexcept ValueError as e:\n    logger.error(\"Invalid meta_value_type: %s\", e)\n    ranker = MetaFieldRanker(meta_field=\"rating\")  # default None","preventionTips":["Keep meta_value_type in a constant set shared with validation","Only use values from the documented enum","Cover ranker init in unit tests with config loading"],"tags":["validation","ranker","metafield","bad-parameter"],"backgroundTag":"invalid-parameter-value","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}