hasura/graphql-engine · error
operation failed: %w
Error message
operation failed: %w
What it means
Raised by `hasura deploy` (config v2 path) after the deploy finite state machine ends in the failedOperation state. The FSM wraps multi-step deploy operations (e.g. applying migrations); when a step fails, its error is stored in context.err and re-raised as 'operation failed'.
Source
Thrown at cli/commands/deploy.go:171
ec: opts.EC,
logger: opts.EC.Logger,
err: nil,
withSeeds: opts.WithSeeds,
noTransaction: opts.NoTransaction,
perMigrationTransaction: opts.PerMigrationTransaction,
}
if opts.EC.Config.Version <= cli.V2 {
configV2FSM := newConfigV2DeployFSM()
err := configV2FSM.SendEvent(applyMigrations, context)
if err != nil {
return errors.E(op, err)
}
if configV2FSM.Current == failedOperation {
return errors.E(op, fmt.Errorf("operation failed: %w", context.err))
}
return nil
}
configV3FSM := newConfigV3DeployFSM()
err := configV3FSM.SendEvent(applyInitialMetadata, context)
if err != nil {
return errors.E(op, err)
}
if configV3FSM.Current == failedOperation {
return errors.E(op, fmt.Errorf("operation failed: %w", context.err))
}
return nil
}View on GitHub (pinned to 724551b9ae)
Solutions
- Inspect the wrapped context.err (run with debug/verbose logging) to identify the failing step and address it (connectivity, credentials, or the specific migration)
- Verify endpoint, admin secret, and server version compatibility for the target
- Fix or squash the offending migration, then re-run `hasura deploy`
- Ensure config.Version matches the project layout (v2 with migrations directory) you are deploying
Defensive patterns
Strategy: try-catch
Try / catch
if err := deployCmd.Run(); err != nil {
// unwrap with errors.Unwrap / errors.As to reach the underlying migration error
var inner error
if errors.As(err, &inner) { log.Printf("deploy failed: %v", inner) }
} Prevention
- Dry-run migrations against a staging server before deploy
- Pin endpoint/admin secret via env vars validated in CI
- Keep migration chain linear and tested
When it happens
Trigger: `hasura deploy` on a config Version-2 project where the applyMigrations event (or a prior FSM step) fails — e.g. unreachable Hasura endpoint, bad admin secret, malformed/incompatible migration files, or metadata inconsistency.
Common situations: CI deploy with wrong HASURA_GRAPHQL_ENDPOINT/ADMIN_SECRET env vars; migration chain containing an old migration that no longer applies cleanly against the current server version; network/DNS failure to the Hasura instance.
Related errors
- cannot write migration directory: %w
- operation failed: %w
- applying migrations on source: %s: %w
- operation failed: %w
- error serving console: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/759754b8a4f9e363.
Report an issue: GitHub.