canopy-network/canopy · error · ValueError
Invalid data_dir_path: {self.data_dir_path}
Error message
Invalid data_dir_path: {self.data_dir_path} What it means
Fired by Config.__post_init__ when the data_dir_path config value fails validation (empty or otherwise unusable as a data directory). It guards against the plugin starting with a data directory it cannot use, which would cause state writes to fail later.
Source
Thrown at plugin/python/contract/plugin.py:63
# PLUGIN_BUILD is a human-readable build marker logged at startup so operators can confirm, via
# `tail -f /tmp/plugin/python-plugin.log`, that the running binary includes the expected features.
PLUGIN_BUILD = "python-plugin v1 (base SDK + detached custom RPC query path)"
@dataclass
class Config:
"""Plugin configuration matching Go's Config struct."""
chain_id: int = 1
data_dir_path: str = "/tmp/plugin/"
# rpc_address is the listen address for the plugin's own HTTP server that exposes custom RPC endpoints
rpc_address: str = "0.0.0.0:50010"
def __post_init__(self) -> None:
if not isinstance(self.chain_id, int) or self.chain_id < 1:
raise ValueError(f"Invalid chain_id: {self.chain_id}")
if not isinstance(self.data_dir_path, str) or not self.data_dir_path.strip():
raise ValueError(f"Invalid data_dir_path: {self.data_dir_path}")
def default_config() -> Config:
"""Return the default configuration (matching Go's DefaultConfig)."""
return Config(chain_id=1, data_dir_path="/tmp/plugin/", rpc_address="0.0.0.0:50010")
def new_config_from_file(filepath: str) -> Config:
"""Load configuration from JSON file (matching Go's NewConfigFromFile)."""
try:
config_data = json.loads(Path(filepath).read_text(encoding="utf-8"))
return Config(
chain_id=config_data.get("chainId", 1),
data_dir_path=config_data.get("dataDirPath", "/tmp/plugin/"),
rpc_address=config_data.get("rpcAddress", "0.0.0.0:50010"),
)
except Exception as err:
raise ValueError(f"Failed to load config from {filepath}: {err}")View on GitHub (pinned to ee8197d91d)
Solutions
- Set data_dir_path to a valid, existing (or creatable) directory path in the config JSON, e.g. "/tmp/plugin/".
- If the field is absent in the config file, rely on the default by omitting chainId/data_dir_path or fixing malformed JSON.
- Check permissions on the supplied directory so it is usable by the plugin process.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at plugin/python/contract/plugin.py:63 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of canopy-network/canopy@ee8197d91d (2026-09-06).
Data as JSON: /api/errors/f6bf0000c9cf7db0.
Report an issue: GitHub.