{"record":{"id":"c2d0c9b95f8ccb13","repo":"NousResearch/hermes-agent","slug":"goal-must-be-a-non-empty-string-of-at-most-16000-c","errorCode":null,"errorMessage":"goal must be a non-empty string of at most 16000 characters.","messagePattern":"goal must be a non-empty string of at most 16000 characters\\.","errorType":"exception","errorClass":"SubagentLifecycleError","httpStatus":null,"severity":"error","filePath":"agent/subagent_lifecycle.py","lineNumber":494,"sourceCode":"            record.completed_at = result.completed_at\n            record.updated_at = result.completed_at or time.time()\n\n    @staticmethod\n    def _capability(\n        subagent_id: str, parent_session_id: Optional[str], created_at: float\n    ) -> str:\n        value = f\"{subagent_id}|{parent_session_id or ''}|{created_at:.6f}\".encode()\n        return hmac.new(_SECRET, value, hashlib.sha256).hexdigest()\n\n    @staticmethod\n    def _validate_request(request: SubagentLaunchRequest, parent: Any) -> None:\n        if (\n            not isinstance(request, SubagentLaunchRequest)\n            or not isinstance(request.goal, str)\n            or not request.goal.strip()\n            or len(request.goal) > _MAX_GOAL_CHARS\n        ):\n            raise SubagentLifecycleError(\n                \"goal must be a non-empty string of at most 16000 characters.\"\n            )\n        if request.context is not None and (\n            not isinstance(request.context, str)\n            or len(request.context) > _MAX_CONTEXT_CHARS\n        ):\n            raise SubagentLifecycleError(\n                \"context must be a string of at most 32000 characters.\"\n            )\n        if request.role not in {\"leaf\", \"orchestrator\"}:\n            raise SubagentLifecycleError(\"role must be 'leaf' or 'orchestrator'.\")\n        if request.timeout_seconds is not None:\n            raise SubagentLifecycleError(\n                \"Per-launch timeout is not supported; configure delegation timeout explicitly.\"\n            )\n        if request.working_directory is not None:\n            raise SubagentLifecycleError(\n                \"working_directory is not supported because Hermes delegates use isolated task environments.\"","sourceCodeStart":476,"sourceCodeEnd":512,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/agent/subagent_lifecycle.py#L476-L512","documentation":"Validation error from SubagentLifecycleManager._validate_request(): the goal field of SubagentLaunchRequest must be a non-empty, non-whitespace string no longer than _MAX_GOAL_CHARS (16000). It rejects empty goals, non-string goals, whitespace-only goals, and oversized goals before any child is spawned.","triggerScenarios":"Calling launch() with goal=\"\", goal=None, goal=\"   \", goal containing 16000+ characters, or a goal that is a list/dict because the caller forgot to serialize structured input to text.","commonSituations":"Passing raw user input that may be empty (e.g. an empty webhook payload mapped straight to goal); concatenating huge documents into the goal instead of the context field; forwarding a non-string prompt from an upstream API.","solutions":["Trim and check the goal before launching: require a non-empty str within the limit.","Move large reference material into the context field (limit 32000 chars) or a file the child can read, keeping the goal short.","Coerce non-string input explicitly (str(...) on validated data) or reject it at your API boundary."],"exampleFix":"# before\nrequest = SubagentLaunchRequest(goal=raw_user_input)\n\n# after\ngoal = (raw_user_input or \"\").strip() if isinstance(raw_user_input, str) else \"\"\nif not goal:\n    raise ValueError(\"goal required\")\nrequest = SubagentLaunchRequest(goal=goal[:16000])","handlingStrategy":"validation","validationCode":"MAX_GOAL = 16000\ngoal = goal if isinstance(goal, str) else \"\"\ngoal = goal.strip()\nassert goal and len(goal) <= MAX_GOAL, \"goal must be 1..16000 chars of text\"\nrequest = SubagentLaunchRequest(goal=goal)","typeGuard":"def is_valid_goal(value: object) -> bool:\n    return isinstance(value, str) and bool(value.strip()) and len(value) <= 16000","tryCatchPattern":"try:\n    manager.launch(request)\nexcept SubagentLifecycleError as exc:\n    if \"goal must be\" in str(exc):\n        raise ValueError(\"invalid goal from upstream\") from exc\n    raise","preventionTips":["Validate goal at your API boundary: non-empty str, trimmed, <=16000 chars.","Put long reference material in context (32000) or a file, never in goal.","Reject empty user input before it reaches launch()."],"tags":["subagents","delegation","validation","input"],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}