{"record":{"id":"759754b8a4f9e363","repo":"hasura/graphql-engine","slug":"operation-failed-w","errorCode":null,"errorMessage":"operation failed: %w","messagePattern":"operation failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/deploy.go","lineNumber":171,"sourceCode":"\t\tec:        opts.EC,\n\t\tlogger:    opts.EC.Logger,\n\t\terr:       nil,\n\t\twithSeeds: opts.WithSeeds,\n\n\t\tnoTransaction:           opts.NoTransaction,\n\t\tperMigrationTransaction: opts.PerMigrationTransaction,\n\t}\n\n\tif opts.EC.Config.Version <= cli.V2 {\n\t\tconfigV2FSM := newConfigV2DeployFSM()\n\n\t\terr := configV2FSM.SendEvent(applyMigrations, context)\n\t\tif err != nil {\n\t\t\treturn errors.E(op, err)\n\t\t}\n\n\t\tif configV2FSM.Current == failedOperation {\n\t\t\treturn errors.E(op, fmt.Errorf(\"operation failed: %w\", context.err))\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tconfigV3FSM := newConfigV3DeployFSM()\n\n\terr := configV3FSM.SendEvent(applyInitialMetadata, context)\n\tif err != nil {\n\t\treturn errors.E(op, err)\n\t}\n\n\tif configV3FSM.Current == failedOperation {\n\t\treturn errors.E(op, fmt.Errorf(\"operation failed: %w\", context.err))\n\t}\n\n\treturn nil\n}","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/deploy.go#L153-L189","documentation":"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'.","triggerScenarios":"`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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := deployCmd.Run(); err != nil {\n    // unwrap with errors.Unwrap / errors.As to reach the underlying migration error\n    var inner error\n    if errors.As(err, &inner) { log.Printf(\"deploy failed: %v\", inner) }\n}","preventionTips":["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"],"tags":["hasura","cli","deploy","fsm","migrations"],"backgroundTag":"migration-apply-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}