{"record":{"id":"41baa95e97b592b6","repo":"NousResearch/hermes-agent","slug":"hermes-failed-to-assign-a-child-identity","errorCode":null,"errorMessage":"Hermes failed to assign a child identity.","messagePattern":"Hermes failed to assign a child identity\\.","errorType":"exception","errorClass":"SubagentLifecycleError","httpStatus":null,"severity":"error","filePath":"agent/subagent_lifecycle.py","lineNumber":240,"sourceCode":"            DEFAULT_MAX_ITERATIONS,\n        )\n\n        child = _build_child_preserving_parent_tools(\n            task_index=0,\n            goal=request.goal,\n            context=request.context,\n            toolsets=list(request.allowed_toolsets)\n            if request.allowed_toolsets\n            else None,\n            model=request.model,\n            max_iterations=DEFAULT_MAX_ITERATIONS,\n            task_count=1,\n            parent_agent=parent,\n            role=request.role,\n        )\n        subagent_id = str(getattr(child, \"_subagent_id\", \"\") or \"\")\n        if not subagent_id:\n            raise SubagentLifecycleError(\"Hermes failed to assign a child identity.\")\n        created = time.time()\n        handle = SubagentHandle(\n            PUBLIC_CONTRACT_VERSION,\n            subagent_id,\n            parent_session_id,\n            request.correlation_id,\n            created,\n            getattr(child, \"provider\", None),\n            getattr(child, \"model\", None),\n            getattr(child, \"_delegate_role\", request.role),\n            int(getattr(child, \"_delegate_depth\", 1) or 1),\n            self._capability(subagent_id, parent_session_id, created),\n        )\n        record = _Record(handle, SubagentState.PENDING, created, agent=child)\n        with _REGISTRY.lock:\n            _REGISTRY.records[subagent_id] = record\n            if request.correlation_id:\n                _REGISTRY.correlations[correlation_key] = subagent_id","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/agent/subagent_lifecycle.py#L222-L258","documentation":"Raised by SubagentLifecycleManager.launch() when the child agent object constructed via _build_child_preserving_parent_tools has no _subagent_id attribute (or an empty one). Every spawned delegate is expected to receive a subagent identity; an empty one means the delegation internals did not run their normal construction path — an internal invariant violation, not a caller-input error.","triggerScenarios":"A Hermes version mismatch where tools/delegate_tool.py no longer sets _subagent_id on children but agent/subagent_lifecycle.py expects it; monkeypatching or wrapping _build_child_preserving_parent_tools in tests/plugins so the attribute is never assigned; a partially-failed child construction that returned a dummy object.","commonSituations":"Upgrading Hermes where delegate_tool internals changed without a matching subagent_lifecycle update; plugins that patch delegation internals (which the code explicitly discourages); running from a mixed checkout (stale .pyc or worktree with some files updated).","solutions":["Update Hermes to a consistent version (pip install -U or git pull) so tools/delegate_tool.py and agent/subagent_lifecycle.py ship from the same release.","Remove any monkeypatching of _build_child_preserving_parent_tools or the child-construction path in tests/plugins; construct children through the public delegation API.","If it persists on a clean install, capture the child object type and report it as a Hermes core bug with the version pair."],"exampleFix":"# before (test/plugin patching internals)\nfrom tools.delegate_tool import _build_child_preserving_parent_tools\n_patched = _build_child_preserving_parent_tools\n# ... patch returns a bare agent without _subagent_id\n\n# after: use the public launch API unpatched\nhandle = manager.launch(SubagentLaunchRequest(goal=\"summarize repo\"))","handlingStrategy":"retry","validationCode":"# not a caller-input error; verify environment consistency first\nimport hermes_constants, tools.delegate_tool, agent.subagent_lifecycle\n# ensure both modules come from the same installed release, e.g.:\n# pip show hermes-agent  (single version, no mixed checkout)","typeGuard":null,"tryCatchPattern":"try:\n    handle = manager.launch(request)\nexcept SubagentLifecycleError as exc:\n    if \"failed to assign a child identity\" in str(exc):\n        # restart/update to a consistent Hermes build, then retry once\n        log_and_upgrade_or_report(exc)\n    else:\n        raise","preventionTips":["Keep Hermes as one coherent install — never mix files from different versions in a worktree.","Do not monkeypatch _build_child_preserving_parent_tools or delegation internals.","Pin your Hermes version in deployments and upgrade whole, not piecemeal."],"tags":["subagents","delegation","internal","invariant"],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}