{"record":{"id":"7935e0f3a42fca74","repo":"langchain-ai/deepagents","slug":"max-content-must-be-positive","errorCode":null,"errorMessage":"--max-content must be positive","messagePattern":"--max-content must be positive","errorType":"validation","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/built_in_skills/deepagents-thread-inspector/scripts/inspect_sessions.py","lineNumber":605,"sourceCode":"        \"--include-metadata\",\n        action=\"store_true\",\n        help=\"Include latest checkpoint metadata\",\n    )\n    return parser\n\n\ndef main() -> None:\n    \"\"\"Parse arguments, inspect the session store, and write JSON to stdout.\n\n    Raises:\n        SystemExit: If the command-line arguments are invalid, the local session\n            store is missing or unsupported, or the Deep Agents Code runtime\n            cannot be located.\n    \"\"\"\n    args = _build_parser().parse_args()\n    if args.max_content < 1:\n        msg = \"--max-content must be positive\"\n        raise SystemExit(msg)\n    if args.list_limit is not None and args.list_limit < 1:\n        msg = \"--list must be positive\"\n        raise SystemExit(msg)\n    if args.list_limit is None and not args.thread_id:\n        msg = \"Provide a thread ID or use --list N\"\n        raise SystemExit(msg)\n    if args.list_limit is not None and args.thread_id:\n        msg = \"Use either a thread ID or --list N, not both\"\n        raise SystemExit(msg)\n\n    _ensure_runtime()\n    warnings.filterwarnings(\n        \"ignore\",\n        message=(\n            \"Core Pydantic V1 functionality isn't compatible with Python 3.14 \"\n            \"or greater.*\"\n        ),\n    )","sourceCodeStart":587,"sourceCodeEnd":623,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/built_in_skills/deepagents-thread-inspector/scripts/inspect_sessions.py#L587-L623","documentation":"Argument validation in `main()` of the thread-inspector CLI: `--max-content` (the per-message content truncation limit) must be >= 1; zero or negative values would produce empty output, so the script exits immediately.","triggerScenarios":"Invoking `inspect_sessions.py <thread> --max-content 0` or a negative number such as `--max-content -100`.","commonSituations":"Attempting to 'disable' content by passing 0, scripted invocations with a computed limit that evaluated to <= 0, or misreading the flag's units.","solutions":["Pass a positive integer, e.g. `--max-content 2000`","Omit the flag to use the default limit","Fix the script/variable supplying the value so it computes a value >= 1"],"exampleFix":"// before\ninspect_sessions.py <id> --max-content 0\n// after\ninspect_sessions.py <id> --max-content 4000","handlingStrategy":"validation","validationCode":"max_content = int(os.environ.get(\"MAX_CONTENT\", 2000))\nif max_content < 1:\n    raise ValueError(\"--max-content must be >= 1\")","typeGuard":"def is_positive_int(v: object) -> bool:\n    return isinstance(v, int) and not isinstance(v, bool) and v >= 1","tryCatchPattern":"try:\n    run_inspector(thread_id, max_content=n)\nexcept SystemExit as e:\n    if \"--max-content must be positive\" in str(e):\n        run_inspector(thread_id, max_content=2000)\n    else:\n        raise","preventionTips":["Validate limit values before building the command line","Don't use 0 to mean 'unlimited'; use a large number or the default","Add asserts in wrapper scripts that computed limits are >= 1"],"tags":["cli","argument-validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}