{"record":{"id":"f6bf0000c9cf7db0","repo":"canopy-network/canopy","slug":"invalid-data-dir-path-self-data-dir-path","errorCode":null,"errorMessage":"Invalid data_dir_path: {self.data_dir_path}","messagePattern":"Invalid data_dir_path: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"plugin/python/contract/plugin.py","lineNumber":63,"sourceCode":"\n# PLUGIN_BUILD is a human-readable build marker logged at startup so operators can confirm, via\n# `tail -f /tmp/plugin/python-plugin.log`, that the running binary includes the expected features.\nPLUGIN_BUILD = \"python-plugin v1 (base SDK + detached custom RPC query path)\"\n\n\n@dataclass\nclass Config:\n    \"\"\"Plugin configuration matching Go's Config struct.\"\"\"\n    chain_id: int = 1\n    data_dir_path: str = \"/tmp/plugin/\"\n    # rpc_address is the listen address for the plugin's own HTTP server that exposes custom RPC endpoints\n    rpc_address: str = \"0.0.0.0:50010\"\n\n    def __post_init__(self) -> None:\n        if not isinstance(self.chain_id, int) or self.chain_id < 1:\n            raise ValueError(f\"Invalid chain_id: {self.chain_id}\")\n        if not isinstance(self.data_dir_path, str) or not self.data_dir_path.strip():\n            raise ValueError(f\"Invalid data_dir_path: {self.data_dir_path}\")\n\n\ndef default_config() -> Config:\n    \"\"\"Return the default configuration (matching Go's DefaultConfig).\"\"\"\n    return Config(chain_id=1, data_dir_path=\"/tmp/plugin/\", rpc_address=\"0.0.0.0:50010\")\n\n\ndef new_config_from_file(filepath: str) -> Config:\n    \"\"\"Load configuration from JSON file (matching Go's NewConfigFromFile).\"\"\"\n    try:\n        config_data = json.loads(Path(filepath).read_text(encoding=\"utf-8\"))\n        return Config(\n            chain_id=config_data.get(\"chainId\", 1),\n            data_dir_path=config_data.get(\"dataDirPath\", \"/tmp/plugin/\"),\n            rpc_address=config_data.get(\"rpcAddress\", \"0.0.0.0:50010\"),\n        )\n    except Exception as err:\n        raise ValueError(f\"Failed to load config from {filepath}: {err}\")","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/canopy-network/canopy/blob/ee8197d91dd410f6592cb650a94c925ee6dc8bad/plugin/python/contract/plugin.py#L45-L81","documentation":"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.","triggerScenarios":"Thrown at plugin/python/contract/plugin.py:63 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ee8197d91dd410f6592cb650a94c925ee6dc8bad","analyzedAt":"2026-09-06T09:30:15.973Z","contentChangedAt":"2026-09-06T09:30:15.973Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}