{"record":{"id":"93aa5e96de079f71","repo":"langgenius/dify","slug":"missing-inputs","errorCode":null,"errorMessage":"missing inputs","messagePattern":"missing inputs","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"api/controllers/console/app/workflow.py","lineNumber":1230,"sourceCode":"    @console_ns.response(403, \"Permission denied\")\n    @console_ns.response(404, \"Node not found\")\n    @setup_required\n    @login_required\n    @account_initialization_required\n    @rbac_permission_required(RBACResourceScope.APP, RBACPermission.APP_TEST_AND_RUN)\n    @get_app_model(mode=[AppMode.ADVANCED_CHAT, AppMode.WORKFLOW])\n    @with_current_user\n    @edit_permission_required\n    def post(self, current_user: Account, app_model: App, node_id: str):\n        \"\"\"\n        Run draft workflow node\n        \"\"\"\n        args_model = DraftWorkflowNodeRunPayload.model_validate(console_ns.payload or {})\n        args = args_model.model_dump(exclude_none=True)\n\n        user_inputs = args_model.inputs\n        if user_inputs is None:\n            raise ValueError(\"missing inputs\")\n\n        workflow_srv = WorkflowService()\n        # fetch draft workflow by app_model\n        draft_workflow = workflow_srv.get_draft_workflow(app_model=app_model, session=db.session())\n        if not draft_workflow:\n            raise ValueError(\"Workflow not initialized\")\n        files = _parse_file(draft_workflow, args.get(\"files\"))\n        workflow_service = WorkflowService()\n\n        workflow_node_execution = workflow_service.run_draft_workflow_node(\n            app_model=app_model,\n            draft_workflow=draft_workflow,\n            node_id=node_id,\n            user_inputs=user_inputs,\n            account=current_user,\n            query=args.get(\"query\", \"\"),\n            files=files,\n        )","sourceCodeStart":1212,"sourceCodeEnd":1248,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/app/workflow.py#L1212-L1248","documentation":"Bare ValueError('missing inputs') raised inside DraftWorkflowNodeRunApi.post (POST /apps/{app_id}/workflows/draft/nodes/{node_id}/run) when args_model.inputs is None. DraftWorkflowNodeRunPayload declares inputs as Optional, so a request omitting the inputs field (or sending it as null) reaches the handler. Because this handler does not catch ValueError, it propagates to Flask and surfaces as an HTTP 400 with message 'missing inputs'.","triggerScenarios":"Posting a node-run request whose JSON body omits 'inputs' or sets it to null; sending only query/files without the inputs object.","commonSituations":"Frontend builds the payload conditionally and skips inputs when the node has no variables; a schema change made inputs optional where callers previously always sent it; raw API client not including inputs.","solutions":["Always include an 'inputs' object in the request body, even an empty {} when there are no variables.","If using DraftWorkflowNodeRunPayload, set inputs to {} rather than leaving it null.","Add client-side validation that inputs is non-null before sending."],"exampleFix":"// before: inputs omitted\n{ \"query\": \"hi\" }\n// after: inputs present (empty is fine)\n{ \"inputs\": {}, \"query\": \"hi\" }","handlingStrategy":"validation","validationCode":"// Ensure inputs is always an object before sending.\nif (body.inputs === undefined || body.inputs === null) body.inputs = {};","typeGuard":"const hasInputs = (b): b is {inputs: Record<string, unknown>} =>\n  !!b && b.inputs !== null && b.inputs !== undefined && typeof b.inputs === 'object';","tryCatchPattern":"try {\n  return await runDraftNode(appId, nodeId, body);\n} catch (e) {\n  if (e?.status === 400 && /missing inputs/i.test(e?.message)) {\n    body.inputs = {}; return retry();\n  }\n  throw e;\n}","preventionTips":["Always send an 'inputs' object, even empty {} for nodes without variables.","Add a client-side payload schema check matching DraftWorkflowNodeRunPayload.","Treat inputs as required in your API client wrapper."],"tags":["validation","inputs","node-run","workflow","debugger","console-api"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}