Skip to content

Unhelpful struct failure, missing parsing failure reason #825

@hexylena

Description

@hexylena

I'm debugging a complex workflow, I'm not familiar with it, and I recently received this error message:

check JSON input; couldn't initialize struct Family Array[Sample] samples from [{"sample_id":
"redacted", "sex": "MALE", "hifi_reads": ["/b.bam"], "fail_reads":
["/a.bam"]}]: initializer for struct

This was very confusing until I added more information in WDL/Value.py:

except Error.InputError as ie:
    raise Error.InputError(
        f"couldn't initialize struct {str(type)} {type.members[k]} {k} from {json.dumps(v)}"
        f": {ie}"
    ) from None

adding the as ie, at least let me see that it was missing a required field, something that wasn't clear from this error:

check JSON input; couldn't initialize struct Family Array[Sample] samples from [{"sample_id":
"redacted", "sex": "MALE", "hifi_reads": ["/b.bam"], "fail_reads":
["/a.bam"]}]: initializer for struct
Sample omits required field(s) (in Wrap.families)

it would of course be nice to know which required field was missing, but at least this got me closer :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    devexDevelopers, developers, developers (developer experience)starternew contributors might start here

    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