Skip to content

[Bug]: verify snapshot crashes when format.json contains a non-object JSON value #746

Closed

Description

@harsh21234i

Minimal reproduction

  1. Create a snapshot directory with valid JSON whose top-level value is an array:

    mkdir -p /tmp/hflow-snapshot-repro
    printf '%s' '[]' > /tmp/hflow-snapshot-repro/format.json
    
  2. Run the verifier:

    uv run hflow verify snapshot /tmp/hflow-snapshot-repro

Expected behavior

The verifier should reject a non-object format.json with a concise invalid-input message and exit code 2.

Actual behavior

The command raises an unhandled exception and exits with code 1:

Traceback ...
File "/repo/src/hflow/snapshot.py", line 984, in verify_dataset_snapshot
found_format = format_marker.get("format")
AttributeError: 'list' object has no attribute 'get'

Definition of done

  • Validate that the top-level JSON value is an object before accessing its fields.
  • Return a clear invalid-input message and exit code 2.
  • Add CLI regression tests for top-level arrays, null, strings, and numbers.

Related: #575 covers malformed integrity.tables and integrity.assets values; this report concerns the top-level value in format.json.

Activity

  1. github-actions commented on Oct 28, 2026

    @github-actions

    👋 Hi @harsh21234i — thank you for opening your first issue on HFlow!

    We appreciate you taking the time to report this. A maintainer will take a look as soon as possible.

    In the meantime, feel free to:

    We are glad to have you here! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions