{"record":{"id":"af32dd4a1ad229e3","repo":"zylon-ai/private-gpt","slug":"invalid-request-error-af32dd","errorCode":"INVALID_REQUEST_ERROR","errorMessage":"Unsupported format strategy: {selected_format_strategy}. Supported strategies are: 'list', 'xml', 'json'.","messagePattern":"Unsupported format strategy: (.+?)\\. Supported strategies are: 'list', 'xml', 'json'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"private_gpt/components/engines/citations/format.py","lineNumber":458,"sourceCode":"                    return _format_documents_as_xml(\n                        documents,\n                        start_token=start_token,\n                        end_token=end_token,\n                        generate_citations=generate_citations,\n                        token_limit=token_limit,\n                        tokenizer_fn=tokenizer_fn,\n                    )\n                case \"json\":\n                    return _format_documents_as_json(\n                        documents,\n                        start_token=start_token,\n                        end_token=end_token,\n                        generate_citations=generate_citations,\n                        token_limit=token_limit,\n                        tokenizer_fn=tokenizer_fn,\n                    )\n                case _:\n                    raise ValueError(\n                        f\"Unsupported format strategy: {selected_format_strategy}.\"\n                        f\" Supported strategies are: 'list', 'xml', 'json'.\"\n                    )\n\n        case \"webpage\":\n            return _format_website_as_list(\n                documents,\n                start_token=start_token,\n                end_token=end_token,\n                generate_citations=generate_citations,\n                token_limit=token_limit,\n                tokenizer_fn=tokenizer_fn,\n            )\n        case _:\n            raise ValueError(\n                f\"Unsupported document type: {type}. Supported types are: 'document'.\"\n            )\n","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/engines/citations/format.py#L440-L476","documentation":"ValueError from the citations formatter's match statement: for document-type context, selected_format_strategy must be one of 'list', 'xml', or 'json' — each routed to a dedicated _format_documents_as_* function. Any other string falls to the catch-all arm and is rejected with the supported set spelled out. Tagged INVALID_REQUEST_ERROR, meaning the strategy value came from (or derives from) request input.","triggerScenarios":"Calling the format routine (directly or via chat/citation settings) with format_strategy set to something like 'markdown', 'text', 'JSON' (uppercase), or '' while document-type documents are being formatted.","commonSituations":"User-supplied or API-supplied format parameter passed through unvalidated; casing/typo differences ('Xml'); stale client sending a strategy name removed in a newer server version; config defaults referencing an old name.","solutions":["Set the strategy to exactly 'list', 'xml', or 'json' (lowercase)","Normalize/lowercase and validate the strategy string at the API boundary before it reaches the formatter","If a client sends an unknown strategy, map old names to current ones or reject with the supported list","Check the response/prompt-format settings block for a stale strategy value"],"exampleFix":"# before\nfmt = format_documents(docs, format_strategy='markdown')  # ValueError\n\n# after\nfmt = format_documents(docs, format_strategy='json')","handlingStrategy":"validation","validationCode":"ALLOWED_STRATEGIES = {'list', 'xml', 'json'}\nstrategy = (strategy or '').lower().strip()\nif strategy not in ALLOWED_STRATEGIES:\n    raise ValueError(f'format_strategy must be one of {sorted(ALLOWED_STRATEGIES)}')","typeGuard":"def is_supported_format_strategy(s: str) -> TypeGuard[str]:\n    return s in {'list', 'xml', 'json'}","tryCatchPattern":"try:\n    formatted = format_documents(docs, format_strategy=strategy)\nexcept ValueError as e:\n    if 'Unsupported format strategy' in str(e):\n        return error_response(400, str(e))\n    raise","preventionTips":["Validate and normalize (lowercase) the strategy at the API boundary","Expose the supported set in your OpenAPI schema as an enum","Map legacy strategy names to current ones during client upgrades"],"tags":["citations","formatting","invalid-request","validation"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}