{"record":{"id":"145c86fa09553fe4","repo":"hasura/graphql-engine","slug":"s-w","errorCode":null,"errorMessage":"%s: %w","messagePattern":"%s: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/internal/hasura/v1graphql/v1graphql.go","lineNumber":69,"sourceCode":"\t}\n\n\terr = json.NewDecoder(responseBody).Decode(&respBody)\n\tif err != nil {\n\t\treturn nil, errors.E(op, err)\n\t}\n\n\tif respBody.Errors != nil {\n\t\tvar b []byte\n\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\"","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/internal/hasura/v1graphql/v1graphql.go#L51-L87","documentation":"This is the fallback wrap in GetIntrospectionSchema applied when the response contained GraphQL errors and unmarshalling them succeeded but produced an error value without further detail; the message is simply '<opName>: <err>'. It represents a server-reported GraphQL error (data-level failure with HTTP 200) rather than a transport or HTTP-status problem — the introspection query executed but the server responded with errors in the GraphQL envelope.","triggerScenarios":"HTTP 200 responses whose body has a populated 'errors' array: e.g. introspection disabled or forbidden for the requesting role, 'validation failed' for malformed introspection queries, role lacking permission on the schema, or server-internal errors surfaced as GraphQL errors.","commonSituations":"Connecting with an admin secret that resolves to a restricted role, running introspection against servers where the schema is intentionally hidden, version skew producing unsupported introspection features, or corrupted metadata causing the GraphQL layer to error.","solutions":["Print the full wrapped error — the underlying GraphQL message usually names the exact cause (permission, validation, disabled introspection)","Retry with the correct admin secret / admin role credentials","Check and repair metadata consistency on the server (inconsistent objects often surface as GraphQL errors)","Match CLI and server major versions so the introspection query is supported"],"exampleFix":"// before\nschema, err := c.GetIntrospectionSchema()\nif err != nil { return err }\n\n// after\nschema, err := c.GetIntrospectionSchema()\nif err != nil {\n  // HTTP was 200; the GraphQL envelope itself reported errors\n  return fmt.Errorf(\"server returned GraphQL errors for introspection: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"// Run a trivial authenticated query first to confirm the role can read the schema\n// POST /v1/graphql {\"query\":\"{ __schema { queryType { name } } }\"} must return data, not errors","typeGuard":"func isGraphqlEnvelopeError(err error) bool {\n  return err != nil && strings.Contains(err.Error(), \"introspection:\") && !strings.Contains(err.Error(), \"decoding\")\n}","tryCatchPattern":"schema, err := c.GetIntrospectionSchema()\nif err != nil {\n  if isGraphqlEnvelopeError(err) {\n    // HTTP 200 but GraphQL errors: the wrapped message names the cause\n    return fmt.Errorf(\"graphql errors: %w\", err)\n  }\n  return err\n}","preventionTips":["Use the admin role for introspection/export operations","Resolve metadata inconsistencies before schema export","Read the full wrapped GraphQL message before changing code"],"tags":["hasura","graphql","introspection","api-error","go"],"backgroundTag":"graphql-response-errors","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}