{"record":{"id":"f2a39d5d17e4ad76","repo":"hasura/graphql-engine","slug":"s-decoding-graphql-responnse-data-w","errorCode":null,"errorMessage":"%s: decoding graphql responnse data: %w","messagePattern":"(.+?): decoding graphql responnse data: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/internal/hasura/v1graphql/v1graphql.go","lineNumber":78,"sourceCode":"\n\t\terr := respBody.Errors.UnmarshalJSON(b)\n\t\tif err != nil {\n\t\t\treturn nil, errors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\"%s: decoding graphql response errors: %w\", opName, err),\n\t\t\t)\n\t\t}\n\n\t\treturn nil, errors.E(op, fmt.Errorf(\"%s: %w\", opName, err))\n\t}\n\n\tvar schema hasura.IntrospectionSchema\n\tif respBody.Data != nil {\n\t\terr = json.Unmarshal(*respBody.Data, &schema)\n\t\tif err != nil {\n\t\t\treturn nil, errors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\"%s: decoding graphql responnse data: %w\", opName, err),\n\t\t\t)\n\t\t}\n\t}\n\n\treturn schema, nil\n}\n\nfunc (c *Client) send(body any, responseBodyWriter io.Writer) (*httpc.Response, error) {\n\tvar op errors.Op = \"v1graphql.Client.send\"\n\n\treq, err := c.NewRequest(http.MethodPost, c.path, body)\n\tif err != nil {\n\t\treturn nil, errors.E(op, err)\n\t}\n\n\tresp, err := c.LockAndDo(context.Background(), req, responseBodyWriter)\n\tif err != nil {\n\t\treturn nil, errors.E(op, err)","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/internal/hasura/v1graphql/v1graphql.go#L60-L96","documentation":"GetIntrospectionSchema raises this error (note the 'responnse' typo in the source) when the introspection response's 'data' field is present but json.Unmarshal of that raw JSON into hasura.IntrospectionSchema fails. The server answered successfully, but the schema payload did not match the Go types the CLI expects — typically due to schema shape changes between GraphQL/Hasura versions or unexpected types in the schema.","triggerScenarios":"An introspection response whose data contains constructs the CLI's IntrospectionSchema struct cannot decode: unknown type kinds from newer GraphQL spec versions (e.g. new directive applications, appliedDirectives), non-string fields where strings are expected, or very large schemas that get truncated by intermediaries producing invalid JSON.","commonSituations":"CLI version older than the Hasura/GraphQL server emitting a newer introspection format, federated/gateway endpoints returning extended schemas, or proxies truncating large introspection payloads.","solutions":["Update the CLI to the latest release matching your server generation — schema decoding gaps are usually fixed in newer versions","If targeting a non-Hasura or federated gateway, introspect a plain Hasura endpoint instead","Verify the response is not truncated (re-run the introspection query with curl and pipe to jq to validate JSON)","Report the schema fragment that fails to decode to the CLI maintainers if versions already match"],"exampleFix":"// before\nschema, err := c.GetIntrospectionSchema()\nif err != nil { return err }\n\n// after\nschema, err := c.GetIntrospectionSchema()\nif err != nil {\n  if strings.Contains(err.Error(), \"decoding graphql responnse data\") {\n    // schema shape mismatch: upgrade CLI or introspect a compatible endpoint\n    return fmt.Errorf(\"introspection schema decode failed (version skew?): %w\", err)\n  }\n  return err\n}","handlingStrategy":"fallback","validationCode":"// Confirm version compatibility before introspecting\n// GET /v1/version on the server; if newer than the CLI's supported major, upgrade the CLI first","typeGuard":"func isSchemaDecodeError(err error) bool {\n  return err != nil && strings.Contains(err.Error(), \"decoding graphql responnse data\")\n}","tryCatchPattern":"schema, err := c.GetIntrospectionSchema()\nif err != nil {\n  if isSchemaDecodeError(err) {\n    // fall back to raw JSON data and decode leniently, or upgrade CLI\n    return handleSchemaDecodeFallback(err)\n  }\n  return err\n}","preventionTips":["Keep CLI version aligned with server version","Introspect plain Hasura endpoints rather than federated gateways when possible","Report decode failures with the offending schema fragment upstream"],"tags":["hasura","graphql","json-decode","introspection","version-skew","go"],"backgroundTag":"introspection-schema-decode-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}