{"record":{"id":"60d4d9d719e8875f","repo":"NousResearch/hermes-agent","slug":"blocked-cron-job-contains-a-gateway-lifecycle-com","errorCode":null,"errorMessage":"Blocked: cron job contains a gateway lifecycle command or persistent launchctl submit operation. This is blocked to prevent agent-driven SIGTERM-respawn loops under launchd/systemd supervision (#30719). Run `hermes gateway restart` from a shell outside the running gateway instead.","messagePattern":"Blocked: cron job contains a gateway lifecycle command or persistent launchctl submit operation\\. This is blocked to prevent agent-driven SIGTERM-respawn loops under launchd/systemd supervision \\(#30719\\)\\. Run `hermes gateway restart` from a shell outside the running gateway instead\\.","errorType":"exception","errorClass":"GatewayLifecycleBlocked","httpStatus":null,"severity":"error","filePath":"cron/lifecycle_guard.py","lineNumber":708,"sourceCode":"    if python_script:\n        # Python is executed by the interpreter, never through a POSIX\n        # shell: the shell-script reference walk is a false-positive\n        # generator on Python sources (pathlib's \"/\" operator resolves to\n        # the filesystem root and trips the regular-file check, blocking\n        # every innocent .py cron script, #77131). The direct command\n        # regex below still scans the full text, so a literal\n        # `hermes gateway restart` embedded in a .py script is still\n        # blocked. Non-regular/oversized script files still fail closed\n        # via the lifecycle-shaped sentinel in _read_script_for_scanning.\n        unsafe = _lifecycle_command_scan_with_data_exemption(combined)\n    else:\n        script_dir = _resolve_script_directory(script) if script else None\n        unsafe = contains_gateway_lifecycle_command_or_referenced_script(\n            combined,\n            cwd=script_dir,\n        )\n    if unsafe:\n        raise GatewayLifecycleBlocked(\n            \"Blocked: cron job contains a gateway lifecycle command or persistent \"\n            \"launchctl submit operation. This is blocked to prevent agent-driven \"\n            \"SIGTERM-respawn loops under launchd/systemd supervision \"\n            \"(#30719). Run `hermes gateway restart` from a shell outside \"\n            \"the running gateway instead.\"\n        )\n","sourceCodeStart":690,"sourceCodeEnd":715,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/cron/lifecycle_guard.py#L690-L715","documentation":"Error \"Blocked: cron job contains a gateway lifecycle command or persistent launchctl submit operation. This is blocked to prevent agent-driven SIGTERM-respawn loops under launchd/systemd supervision (#30719). Run `hermes gateway restart` from a shell outside the running gateway instead.\" thrown in NousResearch/hermes-agent.","triggerScenarios":"Thrown at cron/lifecycle_guard.py:708 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run `hermes gateway restart` from a shell outside the running gateway.","Remove the gateway lifecycle/launchctl command from the cron job."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}