GraphQL MessageType crashes when stored messages omit code (get_shipments returns data: null) #1131
Unanswered
minchaminder
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Upstream report: GraphQL
MessageTypefails when stored messages omitcodeTarget: karrioapi/karrio
Type: Bug report (GitHub Issues disabled — post as Q&A Discussion)
Affects:
v2026.1.32(main) and likely earlier releasesSeverity: High — entire
get_shipmentspage returnsdata: nullSummary
The GraphQL
MessageTyperesolver crashes when deserializing carrier messages that omit thecodefield. This is valid per the SDK and normal storage behavior (lib.to_dictstrips null keys), but GraphQL treatscodeas required at init time despite being declaredOptional[str].Result: dashboard shipments list shows "No shipment found" even when thousands of shipments exist.
Symptoms
GraphQL response (HTTP 200):
{ "data": null, "errors": [{ "message": "MessageType.__init__() missing 1 required keyword-only argument: 'code'", "path": ["shipments", "edges", 2, "node", "messages"] }] }One bad message on one shipment in the page aborts the entire connection.
Root cause
File:
modules/graph/karrio/server/graph/schemas/base/types.pyChargeTypein the same file already uses= Nonedefaults correctly.Why
codeis absent in stored JSONkarrio.core.models.Message):code: str = None— optionallib.to_dictinmodules/sdk/karrio/core/utils/dict.py): strips keys where value isNonecodekey at allThis is not hypothetical — observed in production with 401 message rows missing
code(all fromfreightcom_restrate/customs errors). Any carrier/plugin that omitscodetriggers the same GraphQL failure.Suggested fix
Make optional fields truly optional for Strawberry (match
ChargeType):Also affects
TrackerType.messagesandManifestType.messages(sameMessageType.parse).Regression test
Scope
codeat source (separate improvement)lib.to_dictnull-stripping behaviorReproduction
messagesJSON missingcode:{ "level": "error", "message": "bad or missing data: customs_data.products[0].hsverified: ...", "carrier_id": "freightcomRest", "carrier_name": "freightcom_rest", "details": { "details.customs_data.products[0].hsverified": "..." } }get_shipmentsincludingmessageson that shipmentdata: nullReferences
modules/sdk/karrio/core/models.pylib.to_dictnull stripping:modules/sdk/karrio/core/utils/dict.pylib.to_dict:modules/manager/karrio/server/manager/serializers/shipment.pyOffer
Happy to submit a PR if maintainers prefer — we have a working patch and regression test ready on a fork.
All reactions