HKUDS/nanobot · error · ValueError

Feishu instance at index

Error message

Feishu instance at index {index} must be an object

What it means

Raised by canonical_feishu_section when a persisted multi-instance entry at the given index is not a JSON object (e.g. a bare string or list in the instances array). The section cannot be canonically preserved, so the config update is rejected.

Solutions

  1. Make every entry in the instances array an object with instance fields
  2. Remove malformed entries from the channel configuration
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nanobot/channels/feishu/instances.py:179 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HKUDS/nanobot@42f37dc4c0 (2026-08-26). Data as JSON: /api/errors/5ddfc0ad2fa02b67. Report an issue: GitHub.

Appendix: source

Thrown at nanobot/channels/feishu/instances.py:179

        specs.append(
            ChannelInstanceSpec(
                instance_id=instance_id,
                config=config,
            )
        )

    return specs


def canonical_feishu_section(section: Any, defaults: dict[str, Any]) -> dict[str, Any]:
    """Return a canonical section, rejecting input that cannot be preserved safely."""
    raw_specs, inherited = _feishu_instance_inputs(section, defaults)
    instances: list[dict[str, Any]] = []
    instance_ids: set[str] = set()

    for index, raw in enumerate(raw_specs):
        if not isinstance(raw, dict):
            raise ValueError(f"Feishu instance at index {index} must be an object")
        fallback_id = DEFAULT_INSTANCE_ID if index == 0 else f"assistant-{index + 1}"
        try:
            config = _normalize_feishu_instance(
                cast(dict[str, Any], raw),
                defaults,
                inherited=inherited,
                fallback_id=fallback_id,
            )
        except ValueError as exc:
            raise ValueError(f"Invalid Feishu instance at index {index}: {exc}") from exc

        instance_id = str(config["instanceId"])
        if instance_id in instance_ids:
            raise ValueError(f"duplicate Feishu instance id '{instance_id}'")
        instance_ids.add(instance_id)
        instances.append(config)

    return {"instances": instances}

View on GitHub (pinned to 42f37dc4c0)