{"record":{"id":"5cce0177938c0bd5","repo":"flowable/flowable-engine","slug":"initiator-header-processinitiatorheadername","errorCode":null,"errorMessage":"Initiator header '${processInitiatorHeaderName}': Value must be of type String.","messagePattern":"Initiator header '(.+?)': Value must be of type String\\.","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-camel/src/main/java/org/flowable/camel/ExchangeUtils.java","lineNumber":150,"sourceCode":"\n        return camelVarMap;\n    }\n\n    /**\n     * Gets the value of the Camel header that contains the userId to be set as the process initiator. Returns null if no header name was specified on the Camel route.\n     *\n     * @param exchange The Camel Exchange object\n     * @param endpoint The endPoint implementation\n     * @return The userId of the user to be set as the process initiator\n     */\n    public static String prepareInitiator(Exchange exchange, FlowableEndpoint endpoint) {\n\n        String initiator = null;\n        if (endpoint.isSetProcessInitiator()) {\n            try {\n                initiator = exchange.getIn().getHeader(endpoint.getProcessInitiatorHeaderName(), String.class);\n            } catch (TypeConversionException e) {\n                throw new FlowableException(\"Initiator header '\" +\n                        endpoint.getProcessInitiatorHeaderName() + \"': Value must be of type String.\", e);\n            }\n\n            if (StringUtils.isEmpty(initiator)) {\n                throw new FlowableException(\"Initiator header '\" +\n                        endpoint.getProcessInitiatorHeaderName() + \"': Value must be provided\");\n            }\n        }\n        return initiator;\n    }\n}\n","sourceCodeStart":132,"sourceCodeEnd":162,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-camel/src/main/java/org/flowable/camel/ExchangeUtils.java#L132-L162","documentation":"When a Camel endpoint has setProcessInitiator(true), ExchangeUtils.prepareInitiator reads the configured initiator header and requires its value to be a String usable as the Flowable process initiator. A header present but not convertible to String triggers a TypeConversionException which is wrapped in a FlowableException with this message.","triggerScenarios":"Exchange header named by endpoint.getProcessInitiatorHeaderName() contains a non-String/non-convertible value (e.g. an Integer, complex object) while setProcessInitiator is enabled.","commonSituations":"Producers setting the initiator header to a numeric id or object instead of a String; header name mismatch so the wrong header is read; configuration expecting automatic type coercion that Camel cannot perform.","solutions":["Set the initiator header value to a String, e.g. exchange.getIn().setHeader(headerName, userId.toString())","Or disable setProcessInitiator(false) on the FlowableEndpoint if the initiator is not needed","Check endpoint.setProcessInitiatorHeaderName points to the correct header"],"exampleFix":"// before\nexchange.getIn().setHeader(\"CamelProcessInitiator\", 42);\n// after\nexchange.getIn().setHeader(\"CamelProcessInitiator\", String.valueOf(userId));","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { /* start process */ } catch (FlowableException e) { if (e.getCause() instanceof TypeConversionException) { /* fix header type */ } }","preventionTips":["Coerce header values to String in your Camel producer before sending"],"tags":["camel","header","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}