{"record":{"id":"5423c59700521c1f","repo":"infiniflow/ragflow","slug":"remote-workspace-creation-did-not-return-a-path","errorCode":null,"errorMessage":"Remote workspace creation did not return a path.","messagePattern":"Remote workspace creation did not return a path\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"agent/sandbox/providers/ssh.py","lineNumber":529,"sourceCode":"                except Exception as exc:\n                    errors.append(str(exc))\n\n        raise SandboxProviderConfigError(\"Failed to load SSH private key. \" + \"; \".join(error for error in errors if error))\n\n    def _create_remote_workspace(self, client: paramiko.SSHClient) -> str:\n        base_dir = self.work_dir.rstrip(\"/\") or \"/tmp\"\n        template = posixpath.join(base_dir, \"ragflow-codeexec.XXXXXX\")\n        stdout, stderr, exit_code = self._run_remote_command(\n            client,\n            f\"mkdir -p {shlex.quote(base_dir)} && mktemp -d {shlex.quote(template)}\",\n            timeout=min(self.timeout, 10),\n        )\n        if exit_code != 0:\n            raise RuntimeError(f\"Failed to create remote workspace on {self.host}: {stderr or stdout or 'unknown error'}\")\n\n        remote_work_dir = stdout.strip().splitlines()[-1] if stdout.strip() else \"\"\n        if not remote_work_dir:\n            raise RuntimeError(\"Remote workspace creation did not return a path.\")\n        return remote_work_dir\n\n    def _upload_script(\n        self,\n        sftp: paramiko.SFTPClient,\n        remote_work_dir: str,\n        language: str,\n        code: str,\n        args_json: str,\n    ) -> tuple[str, str]:\n        if language == \"python\":\n            script_name = \"main.py\"\n            script_content = build_python_wrapper(code, args_json)\n        elif language in {\"javascript\", \"nodejs\"}:\n            script_name = \"main.js\"\n            script_content = build_javascript_wrapper(code, args_json)\n        else:\n            raise RuntimeError(f\"Unsupported language for SSH provider: {language}\")","sourceCodeStart":511,"sourceCodeEnd":547,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/sandbox/providers/ssh.py#L511-L547","documentation":"Raised as RuntimeError by _create_remote_workspace when the mktemp command exits 0 but stdout contains no path. The provider takes the last non-empty stdout line as the workspace directory; if the remote shell produces no usable output (exotic shell wrappers, output swallowed by a forced command, or stdout consumed by profile scripts), the path is empty and creation is treated as failed.","triggerScenarios":"SSH account whose forced command or shell wrapper discards stdout; login banners/profiles that redirect or consume stdout so mktemp's output never reaches the channel; a remote shell that does not print mktemp results (non-standard busybox wrappers).","commonSituations":"Bastion accounts with forced command wrappers that multiplex output; shells configured with exec redirects in .profile; extremely minimal embedded systems where mktemp output handling is nonstandard.","solutions":["Run ssh user@host 'mktemp -d /tmp/ragflow-codeexec.XXXXXX' manually and confirm a path prints on stdout","Remove stdout-redirecting statements from the account's shell startup files","Use a plain full-shell account rather than a forced-command wrapper for this provider"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import subprocess\nout = subprocess.run(\n    [\"ssh\", f\"{user}@{host}\", f\"mktemp -d {work_dir}/x.XXXXXX\"],\n    capture_output=True, text=True,\n)\nif out.returncode == 0 and not out.stdout.strip():\n    raise RuntimeError(\"remote shell swallows stdout; account is unsuitable for this provider\")","typeGuard":null,"tryCatchPattern":"try:\n    provider.create_instance(language=\"python\")\nexcept RuntimeError as e:\n    if \"did not return a path\" in str(e):\n        log.error(\"remote account's shell discards stdout; use a plain shell account\")\n        raise","preventionTips":["Avoid forced-command or output-multiplexing shell wrappers for the sandbox account","Keep profile scripts from redirecting stdout","Smoke-test mktemp output over SSH when onboarding a new host"],"tags":["ssh","remote-workspace","shell-environment","stdout"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}