hasura/graphql-engine · error
bulk request failed: %v %v
Error message
bulk request failed: %v %v
What it means
Thrown by the Hasura CLI's v1query Bulk client when a bulk API request to the Hasura server completes but the HTTP response status is not 200. The error message embeds the status code and the raw response body, so the server-side rejection reason (often a GraphQL/metadata error payload) is visible in the message itself. It is wrapped with errors.KindHasuraAPI to mark it as a server API failure rather than a transport failure.
Source
Thrown at cli/internal/hasura/v1query/v1_query.go:77
Type: "bulk",
Args: args,
}
req, err := c.NewRequest(http.MethodPost, c.path, body)
if err != nil {
return nil, errors.E(op, err)
}
responseBody := new(bytes.Buffer)
resp, err := c.LockAndDo(context.Background(), req, responseBody)
if err != nil {
return nil, errors.E(op, err)
} else if resp.StatusCode != http.StatusOK {
return nil, errors.E(
op,
errors.KindHasuraAPI,
fmt.Errorf("bulk request failed: %v %v", resp.StatusCode, responseBody.String()),
)
}
return responseBody, nil
}
View on GitHub (pinned to 724551b9ae)
Solutions
- Read the response body embedded in the message — it usually contains the exact Hasura error (e.g. 'x-hasura-admin-secret missing' or a metadata validation error)
- Verify the endpoint and admin secret configuration used to construct the v1query client
- Reproduce with a single query instead of a bulk to isolate which item in the batch fails
- Check Hasura server logs if the body is unhelpful or the status is 5xx
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check server reachability and auth before issuing the bulk call
req, _ := http.NewRequest(http.MethodGet, endpoint+"/v1/version", nil)
req.Header.Set("X-Hasura-Admin-Secret", adminSecret)
resp, err := http.DefaultClient.Do(req)
if err != nil || resp.StatusCode != http.StatusOK { /* fix endpoint/secret first */ } Type guard
func isHasuraAPIError(err error) bool {
var e *errors.Error
return errors.As(err, &e) && e.Kind == errors.KindHasuraAPI
} Try / catch
body, err := client.Bulk(queries)
if err != nil {
if isHasuraAPIError(err) {
// message contains status + server body; surface it, do not retry blindly
return fmt.Errorf("hasura rejected bulk request: %w", err)
}
return err // transport error: retryable
} Prevention
- Validate endpoint and admin secret with a cheap /v1/version call before bulk operations
- Keep metadata queries within the schema supported by the target server version
- Log the full error message — the embedded response body pinpoints the failing query
When it happens
Trigger: Calling Bulk(...) with a list of v1 queries (e.g. metadata reload/export/apply batches) against a Hasura instance that returns a non-200 status: 400 for malformed query bodies, 401/404 when the endpoint path or admin secret is wrong, 500 when the server fails to process one of the bulked queries.
Common situations: Wrong or missing X-Hasura-Admin-Secret header (401), pointing the CLI at a Hasura Cloud endpoint vs. CE with mismatched API paths, sending a metadata object the server version doesn't support, or a server-side crash mid-batch during `hasura metadata apply`.
Related errors
- error fetching config from server: %w
- error fetching server config: %v
- cannot write metadata directory: %w
- cannot create metadata files: %w
- got error while getting the sources list : %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/cd05eca3aa303720.
Report an issue: GitHub.