OpenBMB/ChatDev · error · ConfigError

write must be boolean

Error message

write must be boolean

What it means

MemoryRetrieveConfig.from_dict requires 'write' (default True) to be a Python bool, mirroring the 'read' check. Non-bool values raise this ConfigError with path pointing at 'write'.

Source

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

                        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",
            display_name="Memory Name",
            type_hint="str",
            required=True,
            description="Name of the referenced memory store",

View on GitHub (pinned to 4fb2db0ea9)

Solutions

  1. Use an unquoted boolean literal for write
  2. Convert string values to bool explicitly before parsing
  3. Omit the key to default to true

Example fix

# before
write: 'true'
# after
write: true
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 'write must be boolean' in str(e):
        d['write'] = str(d['write']).lower() in ('true', '1')
        MemoryRetrieveConfig.from_dict(d, path='retrieve')

Prevention

When it happens

Trigger: Setting write: 'true', write: 0, or any non-bool value in the retrieve config mapping.

Common situations: Same as 'read': stringified booleans from env vars, quoted YAML/JSON values, template-rendered configs.

Related errors


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