{"record":{"id":"792c067da59dca90","repo":"hasura/graphql-engine","slug":"error-creating-migrate-instance-w","errorCode":null,"errorMessage":"error creating migrate instance: %w","messagePattern":"error creating migrate instance: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/pkg/console/apiserver.go","lineNumber":87,"sourceCode":"\t\t\t\t\tCode:    \"internal_error\",\n\t\t\t\t\tMessage: errMessage{updateRequiredMessage}.Error(),\n\t\t\t\t}\n\t\t\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, &r)\n\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tc.Next()\n\t}\n}\n\nfunc NewAPIServer(address string, port string, ec *cli.ExecutionContext) (*APIServer, error) {\n\tvar op errors.Op = \"console.NewAPIServer\"\n\n\tmigrate, err := migrate.NewMigrate(ec, false, \"\", hasura.SourceKindPG)\n\tif err != nil {\n\t\treturn nil, errors.E(op, fmt.Errorf(\"error creating migrate instance: %w\", err))\n\t}\n\n\tgin.SetMode(gin.ReleaseMode)\n\n\trouter := gin.New()\n\t// Setup API Router\n\t// Switch to \"release\" mode in production.\n\tgin.SetMode(gin.ReleaseMode)\n\t// An Engine instance with the Logger and Recovery middleware already attached.\n\trouter.Use(allowCors())\n\trouter.Use(cliProjectUpdateCheck(ec))\n\n\tapiServer := &APIServer{Router: router, Migrate: migrate, Address: address, Port: port, EC: ec}\n\tapiServer.setRoutes(ec.MigrationDir, ec.Logger)\n\n\treturn apiServer, nil\n}\n","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/pkg/console/apiserver.go#L69-L105","documentation":"NewAPIServer (the console's API backend) starts by creating a Migrate instance via migrate.NewMigrate; any failure there is re-wrapped as 'error creating migrate instance'. The root cause is in the wrapped error — usually server connectivity, config validation, or an unsupported source kind.","triggerScenarios":"Running `hasura console` when the migrate instance can't be built: server URL wrong/unreachable, admin secret missing, config version issues, or the database source kind doesn't support migrations.","commonSituations":"`hasura console` against a server that isn't started yet; endpoint typo in config.yaml; admin secret env var not exported in the shell; using a source kind (e.g. a data-connectors source) unsupported by migrations.","solutions":["Check the wrapped error for the real cause","Ensure the Hasura server is up: curl http://localhost:8080/healthz","Verify endpoint + admin secret in config.yaml / env","Confirm the default source kind is a migrations-supported kind (PG/Citus/Cockroach/MSSQL/BigQuery)"],"exampleFix":"# before\n$ hasura console   # server not yet started -> error creating migrate instance\n\n# after\n$ docker compose up -d   # start hasura first\n$ hasura console","handlingStrategy":"try-catch","validationCode":"if _, err := http.Get(ec.Config.ServerConfig.Endpoint + \"/healthz\"); err != nil {\n    return fmt.Errorf(\"start Hasura server before console: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"api, err := console.NewAPIServer(addr, port, ec)\nif err != nil {\n    // wrapped error carries the migrate failure cause; fix config and retry\n    return err\n}","preventionTips":["Start the Hasura server before `hasura console`","Export HASURA_GRAPHQL_ADMIN_SECRET in the shell/profile","Pin compatible CLI/server versions"],"tags":["console","migrations","configuration","hasura"],"backgroundTag":"migrate-init-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}