{"record":{"id":"65da4f6db2847b41","repo":"hasura/graphql-engine","slug":"error-creating-migration-files-w","errorCode":null,"errorMessage":"error creating migration files: %w","messagePattern":"error creating migration files: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/migrate_create.go","lineNumber":302,"sourceCode":"\t\t}\n\n\t\tif !o.downSQLChanged {\n\t\t\tcreateOptions.SQLDown = []byte(``)\n\t\t}\n\t}\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terr := createOptions.Delete()\n\t\t\tif err != nil {\n\t\t\t\to.EC.Logger.Warnf(\"cannot delete dangling migrations: %v\", err)\n\t\t\t}\n\t\t}\n\t}()\n\n\terr = createOptions.Create()\n\tif err != nil {\n\t\treturn 0, herrors.E(op, fmt.Errorf(\"error creating migration files: %w\", err))\n\t}\n\n\to.EC.Spinner.Stop()\n\to.EC.Logger.Infof(\"Created Migrations\")\n\n\tif o.fromServer {\n\t\topts := &MigrateApplyOptions{\n\t\t\tEC:               o.EC,\n\t\t\tSkipExecution:    true,\n\t\t\tVersionMigration: strconv.FormatInt(timestamp, 10),\n\t\t\tSource:           o.Source,\n\t\t}\n\n\t\terr := opts.Run()\n\t\tif err != nil {\n\t\t\to.EC.Logger.Warnf(\"cannot mark created migration %d as applied: %v\", timestamp, err)\n\t\t\to.EC.Logger.Warnf(\n\t\t\t\t\"manually mark it as applied using command:  hasura migrate apply --skip-execution --version %d\",","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/migrate_create.go#L284-L320","documentation":"Final step of `hasura migrate create`: createOptions.Create() writes the migration files (up.sql/down.sql) into migrations/<name>/. This wraps filesystem errors during that write, after the spinner is stopped.","triggerScenarios":"migrations directory or migrations/<source>/ is read-only, missing, or a name collision occurs; disk full; permission denied.","commonSituations":"Running in CI with a read-only checkout; directory removed manually; ownership issues after cloning as another user.","solutions":["Ensure migrations/<database>/ exists and is writable: mkdir -p migrations/<name> && chmod u+w migrations/<name>","Run from a writable clone/checkout","Freeze check: df -h if disk is full; remove half-written migration dirs from the failed attempt"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"mkdir -p \"migrations/$DB\" && test -w \"migrations/$DB\" || { echo 'migrations dir not writable'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure CI checkouts are writable where migrations are created","Clean partial migration dirs after failed creates"],"tags":["migrate-create","file-write","filesystem"],"backgroundTag":"migration-file-write-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}