{"record":{"id":"44cfdb0f0453fc10","repo":"quarkusio/quarkus","slug":"unhandled-type-rawtype","errorCode":null,"errorMessage":"Unhandled type: \" + rawType","messagePattern":"Unhandled type: \" \\+ rawType","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientResponseCompleteRestHandler.java","lineNumber":135,"sourceCode":"                                fieldFiller.set(result, fieldValue);\n                            }\n                        } else if (httpData instanceof FileUpload fu) {\n                            fieldFiller.set(result, new FileDownloadImpl(fu));\n                        } else {\n                            throw new IllegalArgumentException(\"Unsupported multipart message element type. \" +\n                                    \"Expected FileAttribute or Attribute, got: \" + httpData.getClass());\n                        }\n                    }\n                } // close the else block for non-EntityPart multipart\n            } else {\n                Class<?> rawType = context.getResponseType().getRawType();\n                if (context.isFileDownload()) {\n                    if (File.class.equals(rawType)) {\n                        builder.entity(new File(context.getTmpFilePath()));\n                    } else if (Path.class.equals(rawType)) {\n                        builder.entity(Paths.get(context.getTmpFilePath()));\n                    } else {\n                        throw new IllegalStateException(\"Unhandled type: \" + rawType);\n                    }\n                    context.clearTmpFilePath();\n                } else if (!void.class.equals(rawType)) {\n                    Object entity = context.readEntity(entityStream,\n                            context.getResponseType(),\n                            responseContext.getMediaType(),\n                            context.getMethodDeclaredAnnotationsSafe(),\n                            // FIXME: we have strings, it wants objects, perhaps there's\n                            // an Object->String conversion too many\n                            (MultivaluedMap) responseContext.getHeaders());\n                    if (entity != null) {\n                        builder.entity(entity);\n                    }\n                    if (entity != null && !(entity instanceof InputStream)) {\n                        entityStream.close();\n                    }\n                }\n            }","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientResponseCompleteRestHandler.java#L117-L153","documentation":"For a file-download response, the handler writes the body to a temp file and then must materialize it as the declared return type. Only java.io.File and java.nio.file.Path are supported; any other raw type declared by the client method while the response is classified as a file download triggers IllegalStateException.","triggerScenarios":"A client method annotated to trigger file download (e.g. @Produces file media types with the download handling enabled) whose return type is neither File nor Path — e.g. returning byte[], String, or a custom type.","commonSituations":"Mixing response-type handling: declaring a custom DTO for an octet-stream response; switching return types during refactoring without changing the download handling expectation; upgrading Quarkus where file-download detection tightened.","solutions":["Change the client method return type to java.io.File or java.nio.file.Path.","If you need other types, drop the file-download handling (adjust @Produces / annotations) and use the normal entity reader (e.g. byte[] with a matching media type).","Check the @ Produces media types on the client method so the response is not misclassified as a file download.","Return Response/FileDownload if you need streaming control."],"exampleFix":"// before\n@GET @Produces(\"application/octet-stream\")\nbyte[] download();\n// after\n@GET @Produces(\"application/octet-stream\")\nPath download();","handlingStrategy":"validation","validationCode":"// File download methods must return File or Path\nstatic void checkDownloadMethod(Method m, boolean isFileDownload) {\n  if (isFileDownload && !(m.getReturnType() == File.class || m.getReturnType() == Path.class)) {\n    throw new IllegalStateException(\"Download method must return File or Path, got \" + m.getReturnType());\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use File or Path as return types for file-download client methods","Keep @Produces media types consistent with the return type","Use byte[]/InputStream only when download handling is not triggered"],"tags":["rest-client","file-download","response-processing"],"backgroundTag":"unsupported-response-type","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}