From e38c33c1b560fe6015a917cff758d087a196abf2 Mon Sep 17 00:00:00 2001 From: vasilije Date: Sun, 11 Jan 2026 16:15:29 +0100 Subject: [PATCH] fix: handle missing chunks_per_batch attribute in cognify CLI command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix AttributeError when args.chunks_per_batch is not present in the argparse.Namespace object. Use getattr() with default value of None to safely access the optional chunks_per_batch parameter. This resolves test failures in test_cli_edge_cases.py where Namespace objects were created without the chunks_per_batch attribute. Changes: - Use getattr(args, 'chunks_per_batch', None) instead of direct access - Update test assertion to expect chunks_per_batch=None parameter 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- cognee/cli/commands/cognify_command.py | 2 +- cognee/tests/cli_tests/cli_unit_tests/test_cli_edge_cases.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cognee/cli/commands/cognify_command.py b/cognee/cli/commands/cognify_command.py index 6c278b4dc..bae03eda2 100644 --- a/cognee/cli/commands/cognify_command.py +++ b/cognee/cli/commands/cognify_command.py @@ -116,7 +116,7 @@ After successful cognify processing, use `cognee search` to query the knowledge chunk_size=args.chunk_size, ontology_file_path=args.ontology_file, run_in_background=args.background, - chunks_per_batch=args.chunks_per_batch, + chunks_per_batch=getattr(args, 'chunks_per_batch', None), ) return result except Exception as e: diff --git a/cognee/tests/cli_tests/cli_unit_tests/test_cli_edge_cases.py b/cognee/tests/cli_tests/cli_unit_tests/test_cli_edge_cases.py index ca27c0f67..ae9e99ac6 100644 --- a/cognee/tests/cli_tests/cli_unit_tests/test_cli_edge_cases.py +++ b/cognee/tests/cli_tests/cli_unit_tests/test_cli_edge_cases.py @@ -373,6 +373,7 @@ class TestCognifyCommandEdgeCases: ontology_file_path=None, chunker=TextChunker, run_in_background=False, + chunks_per_batch=None, )