{"record":{"id":"b2111e4d3e8b3739","repo":"OpenAPITools/openapi-generator","slug":"unsupported-status-resp-code","errorCode":null,"errorMessage":"unsupported status \" + resp.code","messagePattern":"unsupported status \" \\+ resp\\.code","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaHttp4sServerCodegen.java","lineNumber":657,"sourceCode":"                    resp.vendorExtensions.put(\"x-response-location\", true);\n                } else {\n                    responseName = wwwAuthStatusToResponse.get(resp.code);\n                    if (responseName != null) {\n                        resp.vendorExtensions.put(\"x-response-www-auth\", true);\n                    } else {\n                        responseName = allowStatusToResponse.get(resp.code);\n                        if (responseName != null) {\n                            resp.vendorExtensions.put(\"x-response-allow\", true);\n                        } else {\n                            responseName = proxyAuthStatusToResponse.get(resp.code);\n                            if (responseName != null) {\n                                resp.vendorExtensions.put(\"x-response-proxy-auth\", true);\n                            } else {\n                                responseName = statusToResponse.get(resp.code);\n                                if (responseName != null) {\n                                    resp.vendorExtensions.put(\"x-response-standard\", true);\n                                } else {\n                                    throw new IllegalArgumentException(\"unsupported status \" + resp.code);\n                                }\n                            }\n                        }\n                    }\n                }\n\n                resp.vendorExtensions.put(\"x-response\", responseName);\n\n                if (resp.getContent() == null) {\n                    resp.vendorExtensions.put(\"x-generic-response\", true); // non json resp\n                } else {\n                    if (resp.getContent().containsKey(\"application/json\")) {\n                        resp.vendorExtensions.put(\"x-json-response\", true); // json resp\n                    } else {\n                        resp.vendorExtensions.put(\"x-generic-response\", true); // non json resp\n                    }\n                    if (resp.getContent().size() > 1) {\n                        resp.vendorExtensions.put(\"x-generic-response\", true); // non json resp","sourceCodeStart":639,"sourceCodeEnd":675,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaHttp4sServerCodegen.java#L639-L675","documentation":"The scala-http4s-server generator maps every response status in an operation to an http4s Status constructor. It looks the code up in ordered maps: Location-style 3xx, WWW-Authenticate 401, Allow 405, Proxy-Authenticate 407, then standard http4s statuses. If the code appears in none of them, generation throws IllegalArgumentException('unsupported status <code>') because there is no http4s Status to emit.","triggerScenarios":"Generating -g scala-http4s-server from a spec whose operations declare non-standard response codes such as 299, 418-unusual variants, 499, 598, 599, or vendor codes like 277. Note code '0' is internally rewritten to 200 before the lookup, so 0 does not trigger it.","commonSituations":"Gateway/proxy-specific codes (499 client closed request, 599 upstream timeout) documented in internal specs; copied vendor API docs that list unofficial codes; specs that enumerate every observed status from load balancer logs.","solutions":["Replace non-standard response codes in the spec with the closest standard status (e.g. 499->400 or 408, 599->500, 299->200)","Keep non-standard codes in documentation/description text instead of as response keys","If the code is IANA-registered but missing from the generator's map, open an issue/PR adding it to statusToResponse in ScalaHttp4sServerCodegen"],"exampleFix":"# before\nresponses:\n  '499':\n    description: client closed request\n# after\nresponses:\n  '408':\n    description: client closed request (request timeout)","handlingStrategy":"validation","validationCode":"# Lint the spec for status codes http4s cannot represent (Python):\nNON_STANDARD = {'299', '499', '598', '599'}  # codes http4s has no Status for; curate as needed\nfor path, item in spec['paths'].items():\n    for method, op in item.items():\n        if method in {'get','put','post','delete','options','head','patch','trace'}:\n            for code in op.get('responses', {}):\n                assert code == 'default' or code not in NON_STANDARD, \\\n                    f'{method.upper()} {path}: status {code} is unsupported by scala-http4s-server'","typeGuard":null,"tryCatchPattern":"try {\n    new DefaultGenerator().opts(input).generate();\n} catch (IllegalArgumentException e) {\n    // 'unsupported status NNN' - replace that response code in the spec with a standard one and regenerate\n}","preventionTips":["Keep only IANA-standard response codes as response keys; document gateway codes in descriptions","Add a Spectral/spec-lint rule flagging response codes outside the standard set for Scala targets","Remember '0' is auto-converted to 200, so default-style '0' entries are safe"],"tags":["scala","http4s","codegen","http-status","spec-validation","openapi-generator"],"backgroundTag":"unsupported-http-status-code","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}