OpenBMB/ChatDev · error · ConfigError

read must be boolean

Error message

read must be boolean

What it means

MemoryRetrieveConfig.from_dict requires 'read' (default True) to be a Python bool. Any other type — string 'true', int 1, etc. — raises this ConfigError with path pointing at 'read'.

Source

Thrown at entity/configs/node/memory.py:464

                    parsed.append(AgentExecFlowStage(item))
                except ValueError as exc:
                    raise ConfigError(
                        f"retrieve_stage entries must be one of {[stage.value for stage in AgentExecFlowStage]}",
                        extend_path(path, f"retrieve_stage[{idx}]"),
                    ) from exc
            stages = parsed

        top_k_value = mapping.get("top_k", 3)
        if not isinstance(top_k_value, int) or top_k_value <= 0:
            raise ConfigError("top_k must be a positive integer", extend_path(path, "top_k"))

        threshold_value = mapping.get("similarity_threshold", -1.0)
        if not isinstance(threshold_value, (int, float)):
            raise ConfigError("similarity_threshold must be numeric", extend_path(path, "similarity_threshold"))

        read_value = mapping.get("read", True)
        if not isinstance(read_value, bool):
            raise ConfigError("read must be boolean", extend_path(path, "read"))

        write_value = mapping.get("write", True)
        if not isinstance(write_value, bool):
            raise ConfigError("write must be boolean", extend_path(path, "write"))

        return cls(
            name=name,
            retrieve_stage=stages,
            top_k=top_k_value,
            similarity_threshold=float(threshold_value),
            read=read_value,
            write=write_value,
            path=path,
        )

    FIELD_SPECS = {
        "name": ConfigFieldSpec(
            name="name",

View on GitHub (pinned to 4fb2db0ea9)

Solutions

  1. Use an unquoted boolean: read: true / false
  2. Convert string flags with something like value.lower() in ('true','1') before building the mapping
  3. Omit the key to default to true

Example fix

# before
read: 'false'
# after
read: false
Defensive patterns

Strategy: type-guard

Type guard

def is_bool(v) -> bool:
    return isinstance(v, bool)

Try / catch

try:
    MemoryRetrieveConfig.from_dict(d, path='retrieve')
except ConfigError as e:
    if 'read must be boolean' in str(e):
        d['read'] = str(d['read']).lower() in ('true', '1')
        MemoryRetrieveConfig.from_dict(d, path='retrieve')

Prevention

When it happens

Trigger: Setting read: 'true', read: 1, or read: yes-as-string in the retrieve config mapping. (Note: YAML 1.1 'yes' parses as bool; 'true' quoted parses as string.)

Common situations: Env-var or CLI-derived settings injected as strings; JSON produced by tools that stringify booleans; hand-edited configs with quoted booleans.

Related errors


AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27). Data as JSON: /api/errors/b08794f6d42ee3e9. Report an issue: GitHub.