{"record":{"id":"ba0858ee71be9737","repo":"conductor-oss/conductor","slug":"input-has-to-be-a-json-object-s","errorCode":null,"errorMessage":"Input has to be a JSON object: %s","messagePattern":"Input has to be a JSON object: (.+?)","errorType":"exception","errorClass":"TerminateWorkflowException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/com/netflix/conductor/core/execution/evaluators/ValueParamEvaluator.java","lineNumber":40,"sourceCode":"\n@Component(ValueParamEvaluator.NAME)\npublic class ValueParamEvaluator implements Evaluator {\n\n    public static final String NAME = \"value-param\";\n    private static final Logger LOGGER = LoggerFactory.getLogger(ValueParamEvaluator.class);\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public Object evaluate(String expression, Object input) {\n        LOGGER.debug(\"ValueParam evaluator -- evaluating: {}\", expression);\n        if (input instanceof Map) {\n            Object result = ((Map<String, Object>) input).get(expression);\n            LOGGER.debug(\"ValueParam evaluator -- result: {}\", result);\n            return result;\n        } else {\n            String errorMsg = String.format(\"Input has to be a JSON object: %s\", input.getClass());\n            LOGGER.error(errorMsg);\n            throw new TerminateWorkflowException(errorMsg);\n        }\n    }\n}\n","sourceCodeStart":22,"sourceCodeEnd":44,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/core/src/main/java/com/netflix/conductor/core/execution/evaluators/ValueParamEvaluator.java#L22-L44","documentation":"Thrown by ValueParamEvaluator.evaluate() when the input object passed to the evaluator is not a Map. The value-param evaluator extracts a value by key from a JSON object (Map); it cannot operate on a scalar, list, or other type. This is used by SWITCH tasks with evaluatorType 'value-param'. A TerminateWorkflowException means the workflow is terminated with this error — it does not retry.","triggerScenarios":"A SWITCH task configured with evaluatorType 'value-param' where the expression resolves against task input that is a List, String, or null instead of a JSON object. The taskInput map provided to the evaluator is not a Map at runtime.","commonSituations":"A previous task outputs an array or scalar where the SWITCH task expects a JSON object. The input parameter mapping in the workflow definition produces a non-Map value due to a malformed ${...} expression. A JSON field that is expected to be an object is actually a string in the runtime data.","solutions":["Inspect the SWITCH task's input parameters — ensure the value feeding the evaluator resolves to a JSON object (Map) at runtime.","Fix the upstream task so its output is a JSON object, not a scalar or array.","Change the evaluatorType to one that handles non-Map input, or restructure the input mapping.","Add a JSONata or Javascript expression upstream to coerce the value into an object before it reaches the SWITCH task."],"exampleFix":"// workflow definition (before) — $.items is an array\n{\n  \"type\": \"SWITCH\",\n  \"evaluatorType\": \"value-param\",\n  \"expression\": \"items\",\n  \"inputParameters\": { \"items\": \"${workflow.output.items}\" }\n}\n\n// after — extract a specific object key from the array\n{\n  \"type\": \"SWITCH\",\n  \"evaluatorType\": \"value-param\",\n  \"expression\": \"status\",\n  \"inputParameters\": { \"status\": \"${task1.output.status}\" }\n}","handlingStrategy":"type-guard","validationCode":"// Ensure SWITCH value-param input is a Map\nObject inputForEval = taskInput.get(expression);\nif (!(inputForEval instanceof Map)) {\n    throw new IllegalStateException(\n        \"Expected JSON object for value-param, got: \" + inputForEval.getClass());\n}","typeGuard":"private boolean isJsonMap(Object input) {\n    return input instanceof Map;\n}","tryCatchPattern":null,"preventionTips":["Verify upstream task outputs are JSON objects when feeding value-param evaluators.","Test workflow definitions with sample runtime data to catch type mismatches early.","Use defensive expressions to coerce types before the SWITCH task."],"tags":["value-param","evaluator","switch-task","terminate","type-mismatch"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}