HKUDS/nanobot · error · ConfigLoadError
The file is not valid UTF-8.
Error message
The file is not valid UTF-8.
What it means
In load_config, config.json could not be decoded as UTF-8 (UnicodeDecodeError while reading). The loader requires UTF-8 config files, so files saved in UTF-16, Latin-1, or with incompatible encodings are rejected as an io_error; the input at fault is the file's byte encoding.
Solutions
- Re-save config.json as UTF-8 (no BOM)
- Convert with `iconv -f <enc> -t utf-8` if the original encoding is known
- Recreate the file by editing it in a UTF-8-capable editor
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at nanobot/config/loader.py:95 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/bc7cc3c40267ef53.
Report an issue: GitHub.
Appendix: source
Thrown at nanobot/config/loader.py:95
) from exc
config.bind_source_path(path)
_apply_ssrf_whitelist(config)
return config
try:
with path.open(encoding="utf-8") as handle:
data = json.load(handle)
except json.JSONDecodeError as exc:
raise ConfigLoadError(
path,
kind="invalid_json",
summary=(
f"JSON syntax error at line {exc.lineno}, column {exc.colno}: "
f"{_sentence(exc.msg)}"
),
) from exc
except UnicodeDecodeError as exc:
raise ConfigLoadError(
path,
kind="io_error",
summary="The file is not valid UTF-8.",
) from exc
except OSError as exc:
detail = exc.strerror or type(exc).__name__
raise ConfigLoadError(
path,
kind="io_error",
summary=f"Unable to read the file: {_sentence(detail)}",
) from exc
if not isinstance(data, dict):
root_type = type(data).__name__
raise ConfigLoadError(
path,
kind="invalid_root",
summary="The top level of config.json must be a JSON object.",View on GitHub (pinned to 42f37dc4c0)