Skip to content

Calling BaseModel.model_dump_json() with the separators argument causes a TypeError #8

@rahlk

Description

@rahlk

Describe the bug
Calling BaseModel.model_dump_json() with the separators argument causes a TypeError. This breaks JSON output when the CLI attempts to write analysis results.

To Reproduce
Steps to reproduce the behavior:

  1. Run the CLI with --format=json
  2. Let the output path point to a real directory
  3. Observe the crash from _write_output() when writing model_dump_json(separators=(",", ":"))

Expected behavior
The CLI should serialize and write a compact JSON representation of the analysis artifacts without throwing an error.

Logs
Traceback:

  File "__main__.py", line 88, in main
    _write_output(artifacts, output, format)
  File "__main__.py", line 96, in _write_output
    f.write(artifacts.model_dump_json(separators=(",", ":")))
TypeError: BaseModel.model_dump_json() got an unexpected keyword argument 'separators'

Additional context
This error was introduced in the following PR:

Add output format flag with MessagePack compression support

Address issue #6 by implementing a --format flag that allows users to choose between compact JSON and ultra-compressed MessagePack output formats, achieving 80-90% size reduction for large analysis results.

Fix
Remove the separators argument from the model_dump_json() call:

f.write(artifacts.model_dump_json())

Pydantic does not support separators in model_dump_json(). For compact formatting, consider post-processing or using json.dumps(model_dump(), separators=...) instead if needed in the future.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions