{"record":{"id":"8f9a3001218f97b5","repo":"flowable/flowable-engine","slug":"couldn-t-find-a-variable-type-that-is-able-to-seri","errorCode":null,"errorMessage":"couldn't find a variable type that is able to serialize ","messagePattern":"couldn't find a variable type that is able to serialize ","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/types/DefaultVariableTypes.java","lineNumber":68,"sourceCode":"        this.typesMap.clear();\n        for (VariableType type : typesList) {\n            typesMap.put(type.getTypeName(), type);\n        }\n    }\n\n    @Override\n    public VariableType getVariableType(String typeName) {\n        return typesMap.get(typeName);\n    }\n\n    @Override\n    public VariableType findVariableType(Object value) {\n        for (VariableType type : typesList) {\n            if (type.isAbleToStore(value)) {\n                return type;\n            }\n        }\n        throw new FlowableException(\"couldn't find a variable type that is able to serialize \" + value);\n    }\n\n    @Override\n    public int getTypeIndex(VariableType type) {\n        return typesList.indexOf(type);\n    }\n\n    @Override\n    public int getTypeIndex(String typeName) {\n        VariableType type = typesMap.get(typeName);\n        if (type != null) {\n            return getTypeIndex(type);\n        } else {\n            return -1;\n        }\n    }\n\n    @Override","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/types/DefaultVariableTypes.java#L50-L86","documentation":"DefaultVariableTypes.findVariableType iterates the registered VariableType list and returns the first type whose isAbleToStore(value) is true. If no registered type can handle the value's Java class, it throws FlowableException 'couldn't find a variable type that is able to serialize <value>'.","triggerScenarios":"Storing (setVariable/setVariableLocal) a value whose runtime class is not covered by the registered variable types — e.g. an unregistered custom bean, a POJO without a serializer, or a type removed by the JPA/Jackson type not being configured.","commonSituations":"Setting custom POJOs without registering a custom VariableType (e.g. SerializableType covers java.io.Serializable only if the object implements it); after upgrading Flowable where a default type (e.g. JPA entity type) is not registered; storing third-party objects that are not serializable.","solutions":["Make the stored value implement a supported type (e.g. java.io.Serializable, String, Date, byte[]) or store a JSON/string representation","Register a custom VariableType via processEngineConfiguration.setCustomPreVariableTypes / getVariableTypes, implementing isAbleToStore and conversions","Check the value's class at runtime (implements Serializable?) before setting it as a variable","Ensure required optional modules (JPA type, JSON type) are on the classpath and registered"],"exampleFix":"// before\nexecution.setVariable(\"data\", new UnserializableDto(...)); // throws\n// after\npublic class UnserializableDto implements Serializable { ... }\nexecution.setVariable(\"data\", dto);\n// or register:\nconfig.setCustomPreVariableTypes(List.of(new DtoVariableType()));","handlingStrategy":"validation","validationCode":"boolean isStorableVariableValue(Object v) {\n    return v == null || v instanceof String || v instanceof Number || v instanceof Boolean\n        || v instanceof byte[] || v instanceof java.util.Date\n        || v instanceof java.io.Serializable; // plus any custom registered types\n}","typeGuard":null,"tryCatchPattern":"try {\n    execution.setVariable(\"key\", value);\n} catch (org.flowable.common.engine.api.FlowableException e) {\n    if (e.getMessage().startsWith(\"couldn't find a variable type that is able to serialize\")) {\n        execution.setVariable(\"key\", jsonMapper.convertToJsonString(value));\n    } else {\n        throw e;\n    }\n}","preventionTips":["Validate variable values implement Serializable or a natively supported type before setting","Register custom VariableTypes for domain objects via setCustomPreVariableTypes","Ensure optional modules (JPA/JSON types) are registered when storing those kinds of values","Add an integration test setting every variable your processes use"],"tags":["java","flowable","serialization","variables"],"backgroundTag":"incompatible-source-type","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}