{"record":{"id":"2b3587a6e089e172","repo":"quarkusio/quarkus","slug":"not-allowed","errorCode":null,"errorMessage":"Not Allowed","messagePattern":"Not Allowed","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/amazon-lambda/event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockBodyHandler.java","lineNumber":61,"sourceCode":"        if (!((RoutingContextInternal) context).seenHandler(RoutingContextInternal.BODY_HANDLER)) {\n            long contentLength = isPreallocateBodyBuffer ? parseContentLengthHeader(request) : -1;\n            BHandler handler = new BHandler(context, contentLength);\n            request.handler(handler);\n            request.endHandler(v -> handler.end());\n            ((RoutingContextInternal) context).visitHandler(RoutingContextInternal.BODY_HANDLER);\n        } else {\n            // on reroute we need to re-merge the form params if that was desired\n            if (mergeFormAttributes && request.isExpectMultipart()) {\n                request.params().addAll(request.formAttributes());\n            }\n\n            context.next();\n        }\n    }\n\n    @Override\n    public BodyHandler setHandleFileUploads(boolean handleFileUploads) {\n        throw new IllegalStateException(\"Not Allowed\");\n    }\n\n    @Override\n    public BodyHandler setBodyLimit(long bodyLimit) {\n        this.bodyLimit = bodyLimit;\n        return this;\n    }\n\n    @Override\n    public BodyHandler setUploadsDirectory(String uploadsDirectory) {\n        this.uploadsDir = uploadsDirectory;\n        return this;\n    }\n\n    @Override\n    public BodyHandler setMergeFormAttributes(boolean mergeFormAttributes) {\n        this.mergeFormAttributes = mergeFormAttributes;\n        return this;","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/amazon-lambda/event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockBodyHandler.java#L43-L79","documentation":"MockBodyHandler is a stub Vert.x BodyHandler used by the AWS Lambda mock event server. It intentionally does not support file uploads, so calling setHandleFileUploads on it always throws IllegalStateException(\"Not Allowed\"). It exists only to satisfy the BodyHandler interface for mock-server routing.","triggerScenarios":"Calling setHandleFileUploads(true/false) on the MockBodyHandler instance used by the MockEventServer, typically via Vert.x route configuration code that customizes body handling.","commonSituations":"Customizing Vert.x routes in tests that reuse the mock event server's handlers; framework code that unconditionally calls setHandleFileUploads on any BodyHandler.","solutions":["Do not call setHandleFileUploads on MockBodyHandler; it is not supported by design","If file-upload configuration is required, use the standard Vert.x BodyHandler instead of the mock handler","Configure body limits via setBodyLimit, which is supported, instead of file-upload settings"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (handler instanceof MockBodyHandler) {\n    // skip setHandleFileUploads — unsupported stub\n} else {\n    handler.setHandleFileUploads(true);\n}","typeGuard":"boolean supportsFileUploadConfig(BodyHandler h) { return !(h instanceof MockBodyHandler); }","tryCatchPattern":"try { handler.setHandleFileUploads(false); } catch (IllegalStateException e) { LOGGER.warn(\"file uploads not configurable on mock handler\"); }","preventionTips":["Don't configure file uploads on the mock event server handlers","Use standard Vert.x BodyHandler when you need body/upload customization"],"tags":["vertx","unsupported-operation","mock-server","amazon-lambda"],"backgroundTag":"unsupported-operation","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}