HKUDS/nanobot · error · ValueError
scratchpad is full (max keys)
Error message
scratchpad is full (max {max_keys} keys) What it means
Raised during preset snapshotting in runtime_control when the agent scratchpad already holds max_keys entries and a new key would be added. The scratchpad is bounded to keep tool-result memory small; a leaky or key-per-call pattern (e.g. unbounded dynamic key names) exhausts it.
Solutions
- Delete unused scratchpad keys before adding new ones
- Use a fixed set of key names instead of dynamic per-call keys
- Raise the scratchpad size limit in configuration if the workload legitimately needs more keys
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at nanobot/agent/tools/runtime_control.py:230 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/45a098680b03cdbf.
Report an issue: GitHub.
Appendix: source
Thrown at nanobot/agent/tools/runtime_control.py:230
self.__target.max_iterations = value
self.__target.subagents.max_iterations = value
def set_context_window_tokens(self, value: int) -> LLMRuntime:
return self.__target.set_runtime_context_window(value)
def set_provider_retry_mode(self, value: str) -> None:
self.__target.provider_retry_mode = value
def set_max_tool_result_chars(self, value: int) -> None:
self.__target.max_tool_result_chars = value
def set_workspace_display(self, value: str) -> None:
"""Preserve MyTool display compatibility without changing path enforcement."""
self.__workspace_display = value
def set_scratchpad(self, key: str, value: JsonValue, *, max_keys: int) -> None:
if key not in self.__scratchpad and len(self.__scratchpad) >= max_keys:
raise ValueError(f"scratchpad is full (max {max_keys} keys)")
self.__scratchpad[key] = value
def _snapshot_model_presets(
presets: Mapping[str, ModelPresetConfig],
) -> dict[str, dict[str, object]]:
return {
name: {
"model": preset.model,
"provider": preset.provider,
"max_tokens": preset.max_tokens,
"context_window_tokens": preset.context_window_tokens,
"temperature": preset.temperature,
"reasoning_effort": preset.reasoning_effort,
}
for name, preset in presets.items()
}
View on GitHub (pinned to 42f37dc4c0)