{"record":{"id":"f8e1992a16c8d56c","repo":"openai/openai-python","slug":"unknown-array-format-value-array-format-choose","errorCode":null,"errorMessage":"Unknown array_format value: {array_format}, choose from {', '.join(get_args(ArrayFormat))}","messagePattern":"Unknown array_format value: (.+?), choose from (.+?)","errorType":"validation","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"src/openai/_qs.py","lineNumber":111,"sourceCode":"                ]\n            elif array_format == \"repeat\":\n                items = []\n                for item in value:\n                    items.extend(self._stringify_item(key, item, opts))\n                return items\n            elif array_format == \"indices\":\n                items = []\n                for i, item in enumerate(value):\n                    items.extend(self._stringify_item(f\"{key}[{i}]\", item, opts))\n                return items\n            elif array_format == \"brackets\":\n                items = []\n                key = key + \"[]\"\n                for item in value:\n                    items.extend(self._stringify_item(key, item, opts))\n                return items\n            else:\n                raise NotImplementedError(\n                    f\"Unknown array_format value: {array_format}, choose from {', '.join(get_args(ArrayFormat))}\"\n                )\n\n        serialised = self._primitive_value_to_str(value)\n        if not serialised:\n            return []\n        return [(key, serialised)]\n\n    def _primitive_value_to_str(self, value: PrimitiveData) -> str:\n        # copied from httpx\n        if value is True:\n            return \"true\"\n        elif value is False:\n            return \"false\"\n        elif value is None:\n            return \"\"\n        return str(value)\n","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/_qs.py#L93-L129","documentation":"The query-string serializer encountered an array_format option that isn't one of the recognized ArrayFormat literals (comma, repeated, etc.). This is an internal invariant violation: the value came from SDK defaults or user-provided serialization options and didn't match any known format, so NotImplementedError is raised.","triggerScenarios":"Passing an invalid array_format via custom qs/options to a request with array query params; SDK version drift where a format literal changed but a stale option value is reused.","commonSituations":"Hand-constructing QUERY_SERIALIZER or array_format strings; reusing serialization options across SDK major versions after format names changed.","solutions":["Use only documented array_format values from openai._qs.ArrayFormat (e.g. 'comma', 'repeat'/'variables')","Update custom serializers after upgrading the SDK","Prefer relying on the SDK's default query serializer unless you truly need custom formats"],"exampleFix":"// before\nQUERY_SERIALIZER = QuerySerializer(array_format=\"pipes\")\n// after\nQUERY_SERIALIZER = QuerySerializer(array_format=\"comma\")","handlingStrategy":"validation","validationCode":"from openai._qs import ArrayFormat, get_args\nassert array_format in get_args(ArrayFormat), f'bad array_format: {array_format}'","typeGuard":"from typing import get_args\nfrom openai._qs import ArrayFormat\n\ndef is_valid_array_format(value: object) -> bool:\n    return isinstance(value, str) and value in get_args(ArrayFormat)","tryCatchPattern":null,"preventionTips":["Don't hand-roll array_format strings; reuse ArrayFormat literals","Re-validate custom serializers when upgrading the SDK"],"tags":["python","query-string","serialization","not-implemented"],"backgroundTag":"invalid-query-serialization-option","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}