{"record":{"id":"b78e940ccaa2e584","repo":"langchain-ai/deepagents","slug":"task-requires-non-empty-string-field-descriptio","errorCode":null,"errorMessage":"task() requires non-empty string field `description`","messagePattern":"task\\(\\) requires non-empty string field `description`","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/partners/quickjs/langchain_quickjs/_repl.py","lineNumber":548,"sourceCode":"        bridges = {camel: self._bridge_symbols[camel] for camel in target_names}\n        ctx.eval(_render_tools_namespace_assignment(bridges))\n        self._active_tool_names = target_names\n        self._tools_installed = True\n\n    @staticmethod\n    def _validate_task_payload(\n        payload: dict[str, Any],\n    ) -> tuple[str, str, str | None, dict[str, Any] | None]:\n        \"\"\"Validate JS `task()` input and return its typed fields.\n\n        JS callers pass camelCase keys (`subagentType`, `responseSchema`) as\n        documented in the system prompt; the returned tuple is snake_case for\n        the Python dispatch path.\n        \"\"\"\n        description = payload.get(\"description\")\n        if not isinstance(description, str) or not description:\n            msg = \"task() requires non-empty string field `description`\"\n            raise ValueError(msg)\n\n        subagent_type = payload.get(\"subagentType\")\n        if not isinstance(subagent_type, str) or not subagent_type:\n            msg = \"task() requires non-empty string field `subagentType`\"\n            raise ValueError(msg)\n\n        raw_label = payload.get(\"label\")\n        if raw_label is not None and not isinstance(raw_label, str):\n            msg = \"task() field `label` must be a string when provided\"\n            raise ValueError(msg)\n        label = raw_label.strip() if isinstance(raw_label, str) else None\n        if label == \"\":\n            label = None\n\n        response_schema = payload.get(\"responseSchema\")\n        if response_schema is not None and not isinstance(response_schema, dict):\n            msg = \"task() field `responseSchema` must be an object when provided\"\n            raise ValueError(msg)","sourceCodeStart":530,"sourceCodeEnd":566,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/partners/quickjs/langchain_quickjs/_repl.py#L530-L566","documentation":"`_validate_task_payload` rejects JS `task()` calls whose payload has no `description` field, or whose `description` is not a non-empty string. The library requires a textual description because it is forwarded to the subagent as its instructions. The error is raised as a ValueError before any subagent is dispatched.","triggerScenarios":"JS code in the QuickJS eval calls `task()` with a missing, null, non-string, or empty-string `description` field, e.g. `task({subagentType: 'researcher'})` or `task({description: '', ...})`.","commonSituations":"Model-generated JS omitting `description` because the prompt schema was mis-remembered, dynamic payload built with `undefined` fields, or camelCase/snake_case confusion passing `subagent_type` instead of `subagentType`.","solutions":["Ensure the JS call includes a non-empty string `description`: `task({description: 'Find X', subagentType: 'researcher'})`","If the payload is built dynamically, default/validate description before calling task()","Check the system-prompt task() schema given to the model matches the expected keys"],"exampleFix":"// before\nawait task({ subagentType: 'researcher' })\n// after\nawait task({ description: 'Summarize recent commits', subagentType: 'researcher' })","handlingStrategy":"validation","validationCode":"function canCallTask(p) {\n  return typeof p === 'object' && p !== null\n    && typeof p.description === 'string' && p.description.length > 0;\n}","typeGuard":"function isNonEmptyString(v) {\n  return typeof v === 'string' && v.length > 0;\n}","tryCatchPattern":"try {\n  await task(payload);\n} catch (e) {\n  if (String(e).includes('description')) {\n    throw new Error('task() payload missing non-empty description');\n  }\n  throw e;\n}","preventionTips":["Always include a non-empty description in task() payloads","Validate payloads before dispatch in generated JS","Keep the task() schema in the system prompt accurate"],"tags":["validation","quickjs","task-bridge"],"backgroundTag":"schema-validation-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}