goldenrecursion/godel

Invalid Format constraint violated

aditya-manit opened this issue · 4 comments

Describe the bug
I have all the validation in the code but yet it says Format constraint violated, I am attaching a sample and let me know what constraint is being violated there. I think this is some internal bug

CreateEntityInput(
    statements=[
        StatementInputRecordInput(
            predicate_id="94a8d215-ce32-4379-b18e-2aebf0794882",
            object_entity_id="635dd566-e3f2-4bcd-bc51-95f143b075c7",
            citation_urls=[],
            qualifiers=[],
        ),
        StatementInputRecordInput(
            predicate_id="1e49b96d-f641-4226-91f0-ed42e6de742e",
            object_value="https://github.com/RECYCLEYCY?tab=repositories",
            citation_urls=["https://coinmarketcap.com"],
            qualifiers=[],
        ),
        StatementInputRecordInput(
            predicate_id="42cb158b-e836-45ed-9b56-034668b8f05a",
            object_value="https://www.recycling-token.com/",
            citation_urls=["https://coinmarketcap.com"],
            qualifiers=[],
        ),
        StatementInputRecordInput(
            predicate_id="5387126a-fa27-4a42-8c7f-bf813a6a893d",
            object_value="https://coinmarketcap.com/currencies/recycling-cyc",
            citation_urls=["https://coinmarketcap.com"],
            qualifiers=[],
        ),
        StatementInputRecordInput(
            predicate_id="7258475d-4d22-4182-91bc-c1199de6a009",
            object_value="https://bscscan.com/token/0xcb64f56a1f5865907dc01bef4f828a2ae1d957c4",
            citation_urls=["https://coinmarketcap.com"],
            qualifiers=[],
        ),
        StatementInputRecordInput(
            predicate_id="9934d828-963f-403a-a0da-7a52e0224ef5",
            object_value="https://twitter.com/recyclingcyc",
            citation_urls=["https://coinmarketcap.com"],
            qualifiers=[],
        ),
        StatementInputRecordInput(
            predicate_id="a27218b8-6a4d-47bb-95b6-5a55334fac1c",
            object_value="Recycling CYC",
            citation_urls=["https://coinmarketcap.com"],
            qualifiers=[],
        ),
        StatementInputRecordInput(
            predicate_id="da0b7a6f-7f01-447a-9ddc-f2bb8b51c4f9",
            object_value="1000000000",
            citation_urls=["https://coinmarketcap.com"],
            qualifiers=[],
        ),
        StatementInputRecordInput(
            predicate_id="e3d0cfb4-3ec1-4ef2-ae08-93fa07aa27dc",
            object_value="https://github.com/RECYCLEYCY?tab=repositories",
            citation_urls=["https://coinmarketcap.com"],
            qualifiers=[],
        ),
        StatementInputRecordInput(
            predicate_id="60627261-4e6c-4ebf-8879-914576ade417",
            object_value="https://s2.coinmarketcap.com/static/img/coins/64x64/22214.png",
            citation_urls=["https://coinmarketcap.com"],
            qualifiers=[],
        ),
        StatementInputRecordInput(
            predicate_id="7f3869c1-7dc9-4486-9045-6bade487a49d",
            object_value="Recycling CYC (CYC) is a cryptocurrency and operates on the BNB Smart Chain (BEP20) platform",
            citation_urls=["https://coinmarketcap.com"],
            qualifiers=[],
        ),
    ]
)
response: {
    "errors": [
        {
            "errcode": "22023",
            "extensions": {"messages": [], "exception": {"errcode": "22023"}},
            "message": "Format constraint violated. The object value format is invalid.",
            "locations": [{"line": 2, "column": 1}],
            "path": ["createEntity"],
            "stack": [
                "error: Format constraint violated. The object value format is invalid.",
                "    at Parser.parseErrorMessage (/web/node_modules/pg-protocol/src/parser.ts:369:69)",
                "    at Parser.handlePacket (/web/node_modules/pg-protocol/src/parser.ts:188:21)",
                "    at Parser.parse (/web/node_modules/pg-protocol/src/parser.ts:103:30)",
                "    at Socket.<anonymous> (/web/node_modules/pg-protocol/src/index.ts:7:48)",
                "    at Socket.emit (node:events:513:28)",
                "    at Socket.emit (node:domain:552:15)",
                "    at addChunk (node:internal/streams/readable:324:12)",
                "    at readableAddChunk (node:internal/streams/readable:297:9)",
                "    at Socket.Readable.push (node:internal/streams/readable:234:10)",
                "    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)",
                "    at TCP.callbackTrampoline (node:internal/async_hooks:130:17)",
            ],
        }
    ],
    "data": {"createEntity": None},
}

@aditya-manit
Hmm I'll have to have to take a better look to see which statement is triggering this error, but we've been working on improving error logs for the GraphQL API.

@constantinmusca
We need error logging in the GraphQL API with tracebacks or notices on explicit statements that contain errors i.e. formatting, optional/required/no citations, etc.

I think fixing for better error bubble up, can you confirm if its bug or let me which statement is violating the constraints - object value is either string, number of url -> Strings and number are pretty obvious and I am using a library to check a valid url

Submission GraphQL query error tracebacks now specify which predicates and values are at fault.

The format looks like this:

....
'message': "Triple input (42cb158b-e836-45ed-9b56-034668b8f05a, 12) validation error: The predicate object type doesn't match the object.",
   'locations': [{'line': 2, 'column': 1}],
   'path': ['createEntity'],
   'stack': ["error: Triple input (42cb158b-e836-45ed-9b56-034668b8f05a, 12) validation error: The predicate object type doesn't match the object.",

Could you try this submission again and check the error logs to help you catch this issue?

Sure, will try it again once #34 is resolved