{"record":{"id":"7713df3a25837eea","repo":"infiniflow/ragflow","slug":"unable-to-determine-artifact-entry-type-relative","errorCode":null,"errorMessage":"Unable to determine artifact entry type: {relative_path}","messagePattern":"Unable to determine artifact entry type: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"agent/sandbox/providers/ssh.py","lineNumber":638,"sourceCode":"        sftp: paramiko.SFTPClient,\n        current_dir: str,\n        relative_dir: str,\n        artifacts: list[dict[str, Any]],\n    ) -> None:\n        try:\n            entries = sftp.listdir_attr(current_dir)\n        except FileNotFoundError:\n            return\n\n        for entry in sorted(entries, key=lambda item: item.filename):\n            name = entry.filename\n            remote_path = posixpath.join(current_dir, name)\n            relative_path = posixpath.join(relative_dir, name) if relative_dir else name\n            mode = entry.st_mode\n            if mode is None:\n                mode = sftp.lstat(remote_path).st_mode\n            if mode is None:\n                raise RuntimeError(f\"Unable to determine artifact entry type: {relative_path}\")\n\n            if stat.S_ISLNK(mode):\n                raise RuntimeError(f\"Artifact symlinks are not allowed: {relative_path}\")\n            if stat.S_ISDIR(mode):\n                self._collect_artifacts_recursive(sftp, remote_path, relative_path, artifacts)\n                continue\n            if not stat.S_ISREG(mode):\n                raise RuntimeError(f\"Unsupported artifact entry: {relative_path}\")\n\n            if len(artifacts) >= self.max_artifacts:\n                raise RuntimeError(f\"SSH execution produced more than {self.max_artifacts} artifacts.\")\n\n            size = int(entry.st_size or 0)\n            if size > self.max_artifact_bytes:\n                raise RuntimeError(f\"Artifact exceeds {self.max_artifact_bytes} bytes: {relative_path}\")\n\n            ext = os.path.splitext(name)[1].lower()\n            if ext not in ALLOWED_ARTIFACT_EXTENSIONS:","sourceCodeStart":620,"sourceCodeEnd":656,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/sandbox/providers/ssh.py#L620-L656","documentation":"Raised as RuntimeError during artifact collection when an SFTP directory entry's st_mode is None and a follow-up sftp.lstat() also returns None mode. The provider cannot classify the entry (link/dir/regular) and refuses to guess, because misclassification would bypass the symlink and type guards that follow. This is a defensive guard against pathological SFTP servers rather than a user input error.","triggerScenarios":"Artifact collection on an SFTP server that returns incomplete attrs from listdir_attr and lstat (some embedded/legacy sshd or SFTP wrappers); racing deletion where the entry vanishes between list and lstat; non-POSIX SFTP emulation layers.","commonSituations":"Running the sandbox against NAS appliances or Windows OpenSSH with unusual attribute support; files being cleaned up concurrently by another process inside the workspace.","solutions":["Retry artifact collection once — transient races disappear when the entry is gone or settled","Update/patch the remote SFTP server (OpenSSH) if attrs are consistently missing","Ensure sandboxed code does not delete or mutate its own output directory while execution finishes"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    artifacts = provider.collect_artifacts(instance_id, artifacts_dir)\nexcept RuntimeError as e:\n    if \"Unable to determine artifact entry type\" in str(e):\n        time.sleep(1)\n        artifacts = provider.collect_artifacts(instance_id, artifacts_dir)\n    else:\n        raise","preventionTips":["Keep the artifacts directory quiescent at collection time — no concurrent writers/deleters","Prefer a mainstream OpenSSH server for the sandbox host","Retry once on this specific message; persistent recurrence indicates an SFTP server defect"],"tags":["sftp","artifacts","ssh","filesystem","defensive"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}