{"record":{"id":"1c537e07a5759c28","repo":"conductor-oss/conductor","slug":"workflowdefinition-is-a-string-but-not-a-valid-ds","errorCode":null,"errorMessage":"workflowDefinition is a string, but not a valid DSL string","messagePattern":"workflowDefinition is a string, but not a valid DSL string","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"common/src/main/java/com/netflix/conductor/common/metadata/workflow/SubWorkflowParams.java","lineNumber":159,"sourceCode":"    @Deprecated\n    @JsonIgnore\n    public WorkflowDef getWorkflowDef() {\n        return (WorkflowDef) workflowDefinition;\n    }\n\n    /**\n     * @param workflowDef the workflowDefinition to set\n     */\n    @JsonSetter(\"workflowDefinition\")\n    public void setWorkflowDefinition(Object workflowDef) {\n        if (workflowDef == null) {\n            this.workflowDefinition = workflowDef;\n        } else if (workflowDef instanceof WorkflowDef) {\n            this.workflowDefinition = workflowDef;\n        } else if (workflowDef instanceof String) {\n            if (!(((String) workflowDef).startsWith(\"${\"))\n                    || !(((String) workflowDef).endsWith(\"}\"))) {\n                throw new IllegalArgumentException(\n                        \"workflowDefinition is a string, but not a valid DSL string\");\n            } else {\n                this.workflowDefinition = workflowDef;\n            }\n        } else if (workflowDef instanceof LinkedHashMap) {\n            this.workflowDefinition = TaskUtils.convertToWorkflowDef(workflowDef);\n        } else {\n            throw new IllegalArgumentException(\n                    \"workflowDefinition must be either null, or WorkflowDef, or a valid DSL string\");\n        }\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/common/src/main/java/com/netflix/conductor/common/metadata/workflow/SubWorkflowParams.java#L141-L177","documentation":"SubWorkflowParams.setWorkflowDefinition accepts a String only when it is a DSL expression wrapped in '${...}'. This error fires when the supplied string does not both start with '${' and end with '}' - i.e. it is not a recognized DSL expression. Literal workflow names or raw JSON passed as a string hit this path.","triggerScenarios":"Setting the JSON field 'workflowDefinition' to a plain string that lacks the leading '${' or trailing '}' (e.g. \"myWorkflow\" or \"{\\\"name\\\":...}\" as a String).","commonSituations":"Confusing the 'name' field (a registered sub-workflow reference) with 'workflowDefinition'; sending a serialized WorkflowDef JSON as a string instead of an object; passing a non-DSL template string.","solutions":["If referencing an existing workflow, use the 'name' (and optional 'version') field, not workflowDefinition.","If supplying an inline definition, pass it as a JSON object (LinkedHashMap/WorkflowDef), not a string.","If using a DSL expression, ensure it is wrapped as ${...}."],"exampleFix":"// before: plain string - rejected\n{\"subWorkflowParam\": {\"workflowDefinition\": \"myWorkflow\"}}\n\n// after: reference by name instead\n{\"subWorkflowParam\": {\"name\": \"myWorkflow\", \"version\": 1}}\n// or inline object:\n{\"subWorkflowParam\": {\"workflowDefinition\": {\"name\": \"myWorkflow\", \"version\": 1}}}","handlingStrategy":"validation","validationCode":"// Validate a DSL string before setting workflowDefinition\nstatic boolean isValidDslString(Object v) {\n    return v instanceof String s && s.startsWith(\"${\") && s.endsWith(\"}\");\n}\n// use the 'name' field for references, or an object for inline defs","typeGuard":"// Narrow a workflowDefinition value to its valid forms\nstatic boolean isValidWorkflowDefinition(Object v) {\n    if (v == null) return true;\n    if (v instanceof WorkflowDef) return true;\n    if (v instanceof LinkedHashMap) return true;\n    return v instanceof String s && s.startsWith(\"${\") && s.endsWith(\"}\");\n}","tryCatchPattern":"// Catch malformed workflowDefinition and report clearly\ntry {\n    params.setWorkflowDefinition(raw);\n} catch (IllegalArgumentException e) {\n    throw new BadRequestException(\n        \"workflowDefinition must be null, a WorkflowDef, an object, or a ${...} DSL string\", e);\n}","preventionTips":["Use the 'name'/'version' fields to reference registered sub-workflows.","Pass inline definitions as objects, not strings.","Validate workflowDefinition shape at the API boundary."],"tags":["subworkflow","validation","dsl","json","input"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}