{"record":{"id":"d1fb271781a0eb46","repo":"HKUDS/nanobot","slug":"slack-dm-target-for-user-user-id-could-not-be","errorCode":null,"errorMessage":"Slack DM target for user '{user_id}' could not be opened.","messagePattern":"Slack DM target for user '(.+?)' could not be opened\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"nanobot/channels/slack/runtime.py","lineNumber":386,"sourceCode":"            )\n            cursor = str(response_metadata.get(\"next_cursor\") or \"\").strip()\n            if not cursor:\n                break\n\n        raise ValueError(\n            f\"Slack user '{handle}' was not found. Use '@name' or a concrete DM/channel ID.\"\n        )\n\n    async def _open_dm_for_user(self, user_id: str) -> str:\n        web_api = self._require_web_api()\n        response = cast(\n            dict[str, Any],\n            await web_api.conversations_open(users=user_id),\n        )\n        channel = cast(dict[str, Any], response.get(\"channel\") or {})\n        channel_id = str(channel.get(\"id\") or \"\")\n        if not channel_id:\n            raise ValueError(f\"Slack DM target for user '{user_id}' could not be opened.\")\n        return channel_id\n\n    @staticmethod\n    def _normalize_target_name(value: str) -> str:\n        return value.strip().lstrip(\"#@\").lower()\n\n    @classmethod\n    def _member_matches_handle(cls, member: dict[str, Any], normalized: str) -> bool:\n        profile = cast(dict[str, Any], member.get(\"profile\") or {})\n        candidates = {\n            str(member.get(\"name\") or \"\"),\n            str(profile.get(\"display_name\") or \"\"),\n            str(profile.get(\"display_name_normalized\") or \"\"),\n            str(profile.get(\"real_name\") or \"\"),\n            str(profile.get(\"real_name_normalized\") or \"\"),\n        }\n        return normalized in {cls._normalize_target_name(candidate) for candidate in candidates if candidate}\n","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/channels/slack/runtime.py#L368-L404","documentation":"Error \"Slack DM target for user '{user_id}' could not be opened.\" thrown in HKUDS/nanobot.","triggerScenarios":"Thrown at nanobot/channels/slack/runtime.py:386 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"42f37dc4c0e409eac7818a82d165c5f2757bc075","analyzedAt":"2026-08-26T00:18:52.276Z","schemaVersion":2},"datasetVersion":"2026-08-26T04:18:47.238Z"}