{"record":{"id":"08ced7403a607983","repo":"HKUDS/nanobot","slug":"instance-id-must-match-a-za-z0-9","errorCode":null,"errorMessage":"instance id must match [A-Za-z0-9_-]+","messagePattern":"instance id must match \\[A-Za-z0-9_-\\]\\+","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"nanobot/channels/feishu/instances.py","lineNumber":22,"sourceCode":"\nimport re\nfrom typing import Any, cast\n\nfrom loguru import logger\n\nfrom nanobot.channels.contracts import ChannelInstanceSpec, ChannelManagementSpec\nfrom nanobot.channels.feishu.config import feishu_default_config\nfrom nanobot.config.loader import merge_missing_defaults\n\nDEFAULT_INSTANCE_ID = \"default\"\n_INSTANCE_ID_RE = re.compile(r\"^[A-Za-z0-9_-]+$\")\n\n\ndef validate_instance_id(value: str) -> str:\n    \"\"\"Return a normalized instance id or raise ValueError.\"\"\"\n    instance_id = value.strip()\n    if not instance_id or not _INSTANCE_ID_RE.fullmatch(instance_id):\n        raise ValueError(\"instance id must match [A-Za-z0-9_-]+\")\n    return instance_id\n\n\ndef runtime_channel_name(base_name: str, instance_id: str) -> str:\n    \"\"\"Return the channel key used for routing messages at runtime.\"\"\"\n    return base_name if instance_id == DEFAULT_INSTANCE_ID else f\"{base_name}.{instance_id}\"\n\n\ndef managed_feishu_instance_specs(\n    section: Any,\n    *,\n    enabled_only: bool = True,\n) -> list[ChannelInstanceSpec]:\n    return feishu_instance_specs(\n        section,\n        feishu_default_config(),\n        enabled_only=enabled_only,\n    )","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/channels/feishu/instances.py#L4-L40","documentation":"Error \"instance id must match [A-Za-z0-9_-]+\" thrown in HKUDS/nanobot.","triggerScenarios":"Thrown at nanobot/channels/feishu/instances.py:22 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"}