{"record":{"id":"223494ba9bb48ccb","repo":"langchain-ai/deepagents","slug":"interpreter-ptc-list-entries-must-be-non-empty-s","errorCode":null,"errorMessage":"`interpreter_ptc` list entries must be non-empty strings; got {entry!r}.","messagePattern":"`interpreter_ptc` list entries must be non-empty strings; got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/config.py","lineNumber":2452,"sourceCode":"        normalized = raw.strip().lower()\n        if normalized in {INTERPRETER_PTC_SAFE_SENTINEL, INTERPRETER_PTC_ALL_SENTINEL}:\n            return normalized\n        msg = (\n            f\"Invalid `interpreter_ptc` string {raw!r}; expected 'safe', 'all', \"\n            \"or a list of tool names.\"\n        )\n        raise ValueError(msg)\n    if isinstance(raw, list):\n        if not raw:\n            return False\n        names: list[str] = []\n        for entry in raw:\n            if not isinstance(entry, str) or not entry.strip():\n                msg = (\n                    \"`interpreter_ptc` list entries must be non-empty strings; \"\n                    f\"got {entry!r}.\"\n                )\n                raise ValueError(msg)\n            cleaned = entry.strip()\n            if cleaned.lower() == INTERPRETER_PTC_ALL_SENTINEL:\n                msg = (\n                    \"`interpreter_ptc` list entries cannot include 'all'; use \"\n                    \"'all' as a standalone value or list explicit tool names \"\n                    \"(optionally with the 'safe' preset).\"\n                )\n                raise ValueError(msg)\n            names.append(cleaned)\n        return names\n    msg = (\n        f\"`interpreter_ptc` must be False, 'safe', 'all', or a list of tool \"\n        f\"names; got {type(raw).__name__}.\"\n    )\n    raise ValueError(msg)\n\n\n@dataclass(frozen=True)","sourceCodeStart":2434,"sourceCodeEnd":2470,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/config.py#L2434-L2470","documentation":"When interpreter_ptc is given as a list, _parse_interpreter_ptc requires every entry to be a non-empty string; entries like None, numbers, empty strings, or whitespace-only strings raise this error. This prevents silently allowing an unnamed or malformed tool.","triggerScenarios":"Passing interpreter_ptc = [\"bash\", \"\", 42] or [\"bash\", None] in config, or building the list programmatically with empty/whitespace entries from splitting an input string.","commonSituations":"Parsing a comma-separated env var with str.split(',') producing empty strings ('a,,b'), TOML arrays with placeholder empties, or generated configs inserting nulls.","solutions":["Remove empty, whitespace-only, and non-string entries from the list.","Filter the list before writing it: [t for t in raw if isinstance(t, str) and t.strip()].","If disabling PTC, use the empty list [] or false rather than an entry of empties."],"exampleFix":"// before\ninterpreter_ptc = [\"bash\", \"\"]\n// after\ninterpreter_ptc = [\"bash\"]","handlingStrategy":"validation","validationCode":"if isinstance(raw, str):\n    raw = [t for t in raw.split(\",\") if t.strip()]\nif isinstance(raw, list):\n    raw = [t for t in raw if isinstance(t, str) and t.strip()]","typeGuard":"def is_valid_tool_list(v: object) -> bool:\n    return isinstance(v, list) and all(isinstance(t, str) and t.strip() for t in v)","tryCatchPattern":"try:\n    ptc = _parse_interpreter_ptc(raw_list)\nexcept ValueError as e:\n    logger.error(\"bad interpreter_ptc list: %s\", e)\n    ptc = False","preventionTips":["Filter empty strings when splitting comma-separated input","Coerce TOML arrays to clean string lists at load time","Reject null/numeric placeholders instead of passing them through"],"tags":["config","toml","validation"],"backgroundTag":"invalid-list-entry","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}