{"record":{"id":"67ac592e22b0d7f2","repo":"FoundationAgents/OpenManus","slug":"no-command-provided","errorCode":null,"errorMessage":"no command provided.","messagePattern":"no command provided\\.","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"warning","filePath":"app/tool/bash.py","lineNumber":152,"sourceCode":"    async def execute(\n        self, command: str | None = None, restart: bool = False, **kwargs\n    ) -> CLIResult:\n        if restart:\n            if self._session:\n                self._session.stop()\n            self._session = _BashSession()\n            await self._session.start()\n\n            return CLIResult(system=\"tool has been restarted.\")\n\n        if self._session is None:\n            self._session = _BashSession()\n            await self._session.start()\n\n        if command is not None:\n            return await self._session.run(command)\n\n        raise ToolError(\"no command provided.\")\n\n\nif __name__ == \"__main__\":\n    bash = Bash()\n    rst = asyncio.run(bash.execute(\"ls -l\"))\n    print(rst)\n","sourceCodeStart":134,"sourceCodeEnd":159,"githubUrl":"https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/tool/bash.py#L134-L159","documentation":"The outer Bash tool's execute() accepts a command string; 'restart' is the reserved word that recycles the session, any other non-None string is run, but command=None (no arguments at all) falls through to this ToolError. It is an API-contract error: the tool was invoked without specifying what to do.","triggerScenarios":"Calling execute() with no arguments (or None) when a session already exists — note the code starts/creates the session first, then raises, so the call is wasted work; also hitting it when a caller passes command=None intending 'do nothing'.","commonSituations":"Orchestrators that build commands from templates and pass None on empty input; agent frameworks forwarding an optional field that was omitted in the request.","solutions":["Default the command to a no-op or short-circuit before calling: if not command: return/skip — don't call execute() at all.","Validate at the boundary of your calling code that the command string is non-empty and not None before dispatching to the tool.","If you meant to recycle the shell, pass the literal string 'restart', not None."],"exampleFix":"# before\nawait bash.execute(cmd)  # cmd may be None from an optional template field\n\n# after\nif not cmd:\n    return CLIResult(system=\"skipped: empty command\")\nawait bash.execute(cmd)","handlingStrategy":"validation","validationCode":"if not command:\n    return  # nothing to do — never call execute() with None","typeGuard":"def valid_bash_command(cmd: str | None) -> bool:\n    return isinstance(cmd, str) and bool(cmd.strip())","tryCatchPattern":"try:\n    await bash.execute(cmd)\nexcept ToolError as e:\n    if 'no command provided' in str(e):\n        return  # skip empty commands silently at the orchestration layer\n    raise","preventionTips":["Short-circuit empty/None commands before tool dispatch.","Use 'restart' (string) to recycle the shell, never None.","Validate LLM-emitted tool arguments for required fields upstream."],"tags":["bash","validation","tool-error","api-contract"],"backgroundTag":null,"analyzedSha":"52a13f2a57d8c7f6737eefb02ccf569594d44273","analyzedAt":"2026-08-15T02:33:49.993Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}